SimpleDateFormat myformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c = Calendar.getInstance();
//过去七天
c.setTime(new Date());
c.add(Calendar.DATE, - 7);
Date d = c.getTime();
String day = myformat.format(d);
System.out.println("过去七天:"+day);
//过去一月
c.setTime(new Date());
c.add(Calendar.MONTH, -1);
Date m = c.getTime();
String mon = myformat.format(m);
System.out.println("过去一个月:"+mon);
//过去三个月
c.setTime(new Date());
c.add(Calendar.MONTH,-3);
System.out.println("过去三个月:"+myformat.format(c.getTime()));
//过去一年
c.setTime(new Date());
c.add(Calendar.YEAR,-1);
System.out.println("过去一年:"+myformat.format(c.getTime()));