last day of a month

/ Published in: JavaScript
Save to your folder(s)

Using the day "zero" of the next month...

Copy this code and paste it in your HTML
  1. // get last day of august as day zero of september
  2. var date = new Date(2011, 8, 0);
  3. // get last day of 2011
  4. var date = new Date(2012, 0, 0);
  5. // remember months are zero based!

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.