获取上一天的日期
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
calendar.set(2018, Calendar.MARCH,1);
System.out.println(dateFormat.format(calendar.getTime()));
calendar.set(Calendar.DATE, calendar.get(Calendar.DATE)-1);
System.out.println(dateFormat.format(calendar.getTime()));
输出
2018-03-01
2018-02-28