SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Calendar date = Calendar.getInstance();
date.setTime(new Date());
String str = dft.format(date.getTime());
System.out.println(str);
date.set(Calendar.DATE, date.get(Calendar.DATE) - 1);//日期减一天
String endDate = dft.format(date.getTime());
System.out.println(endDate);