public static String getLastMonth1(Date date) {
SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM");
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, -1);
String lastMonth = dft.format(cal.getTime());
return lastMonth;
}
public boolean lastDay(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
if (calendar.getActualMaximum(Calendar.DAY_OF_MONTH) != calendar.get(Calendar.DAY_OF_MONTH)) {
logger.error("当前日期不是月底最后一天");
return false;
}
return true;
}