1: Calendar calendar=Calendar.getInstance();
calendar.add(Calendar.MONTH,-1);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
String lastDate = format.format(calendar.getTime());
System.out.println(lastDate);
2017-12-25 执行 ---》输出:2017-11
2017-9-25 执行 ---》输出:2017-08