import java.text.Format; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; Calendar c = Calendar.getInstance();//获取当前时间 SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); c.add(Calendar.DATE, -0); String silent_newday = sdf1.format(c.getTime())+" 00:00:00"; c.add(Calendar.DATE, -60);//获取过去60天的 String silent_oldday = sdf1.format(c.getTime())+" 00:00:00"; vars.put("silent_oldday",silent_oldday); vars.put("silent_newday",silent_newday);