How to get last day of the month

后端 未结 9 1005
闹比i
闹比i 2021-02-01 20:37

How can I obtain the last day of the month with the timestamp being 11:59:59 PM?

9条回答
  •  情歌与酒
    2021-02-01 21:32

    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));
    
    Date lastDayOfMonth = cal.getTime();
    

提交回复
热议问题