//方法一
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String maxDateStr = "2018-01-01";
String minDateStr = "";
Calendar calc =Calendar.getInstance();
try {
calc.setTime(sdf.parse(maxDateStr));
calc.add(calc.DATE, -30);
Date minDate = calc.getTime();
minDateStr = sdf.format(minDate);
System.out.println("minDateStr:"+minDateStr);
} catch (ParseException e1) {
e1.printStackTrace();
}
方法二:
Cal