How to get last day of the month

后端 未结 9 1015
闹比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:22

    Do not forget month started with 0 so +1 in month too.

    let enddayofmonth = new Date(year, month, 0).getDate();
    

提交回复
热议问题