//可以设置指定那一天:例如,最近一周,参数传入-7,最近一月,参数传入-30...private String getBeginDate(int date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date beginTime = new Date(); Calendar beginCalendar = Calendar.getInstance(); beginCalendar.setTime(beginTime); beginCalendar.add(Calendar.DATE, date); return sdf.format(beginCalendar.getTime()); }
时间: 2024-10-07 20:11:00