Gets the last day of the previous month

    var year = new new a Date () getFullYear ();.
     var month The = new new a Date () getMonth ();.
     var nowDate = new new a Date (year, month The, 0 );    // last parameter is 0, which means acquiring 2018 October total number of days 
    var lastDay = nowDate.getDate ();   // 31

 

Reproduced in: https: //www.cnblogs.com/hzx-5/p/11045519.html

Guess you like

Origin blog.csdn.net/weixin_33708432/article/details/93624588