public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
System.out.println(getMonthLastDay());;
if(new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime())==getMonthLastDay()){
System.out.println("是最后一天");
}else{
System.out.println("不是最后一天");
}
}
//获取本月最后一天的方法
public static String getMonthLastDay() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
}