/ Published in: JavaScript

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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var month = {LastDay : function(Year,Month){ return 32 - new Date(Year,Month,32).getDate();}} month.LastDay(2000,1); //returns 29 for feb
Comments
