Get date of last day of previous month - Javascript Date Operation

Javascript examples for Date Operation:Month

Description

Get date of last day of previous month

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w ww . j av  a2s  . c  om*/
var Month = 8; 
var Year = 2013; 
var FirstDay = new Date(Year, Month, 1);
var LastDayPrevMonth = new Date(FirstDay - 864e5);
document.body.innerHTML = LastDayPrevMonth;
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials