//修改时间
public String getNextDay(Date date) {
// 获取当天日期
SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMdd");
String d = sdf.format(date);
String m = d.substring(4, 6);
// 获取前一天日期
Calendar calendar = Calendar.getInstance();
String month = null;
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, -1);
Date date2 = calendar.getTime();
// 我们需要的日
String toDay = date2.toString().substring(8, 10);
String day = date.toString().substring(8, 10);
String year = date.toString().substring(date.toString().length() - 4, date.toString().length());
// 如果今天是1月1日那么年份减1
if (date.toString().substring(4, 7).equals("Jan") && day.equals("01")) {
int y = Integer.parseInt(year) - 1;
year = String.valueOf(y);
}
// 如果今天是这个月的1号那么月份减1
else if (day.equals("01")) {
if ((calendar.get(Calendar.MONTH) + 1) < 10) {
month = "0" + String.valueOf(calendar.get(Calendar.MONTH) + 1);
} else {
month = String.valueOf(calendar.get(Calendar.MONTH) + 1);
}
} else {
month = m;
}
return year + month + toDay;
}