java 获取当前时间前7天的日期


public String getStatetime() throws ParseException{

     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");              

Calendar c = Calendar.getInstance();         

c.add(Calendar.DATE, - 7);         

Date monday = c.getTime();       

String preMonday = sdf.format(monday);       

return preMonday; 

 }


你可能感兴趣的:(java)