Date Calendar
https://www.cnblogs.com/lxx2014/p/9394841.html
//得到3个月之前的日期 Date date = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); //获取日历对象 calendar.add(calendar.MONTH, -3); //设置为前3月 calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); date = calendar.getTime(); //返回一个由calendar得到的Date对象 String dateStr = dateFormat.format(date);