Last Date Of Month

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

overflowing day paramter will return date of next month and creates overlapping if we subtract this overlap from 32 we will have the last date of targeted month

Copy this code and paste it in your HTML
  1. var month = {LastDay : function(Year,Month){ return 32 - new Date(Year,Month,32).getDate();}}
  2. month.LastDay(2000,1); //returns 29 for feb

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.