java获取当前时间的前7天时间
2018-04-14 本文已影响0人
zhihaoZzz
public String getStatetime() throws ParseException{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, - 7);
Date time = c.getTime();
String preDay = sdf.format(time);
return preDay;
}