Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function daysInMonth(iMonth, iYear) {
- return 32 - new Date(iYear, iMonth, 32).getDate();
- }
- function daysInMonth(month,year)
- {
- return new Date(year, month, 0).getDate();
- }
- var daysInMonth = (function() {
- var cache = {};
- return function(month,year) {
- var entry = year+"-"+month;
- if (entry in cache)
- return cache[entry];
- return cache[entry] = new Date(year, month, 0).getDate();
- }
- })();
Add Comment
Please, Sign In to add comment