Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- d = new Date(); d.setFullYear(2008, 11, 0); // Sun Nov 30 2008
- var month = 0; // January
- var d = new Date(2008, month + 1, 0);
- alert(d); // last day in January
- IE 6: Thu Jan 31 00:00:00 CST 2008
- IE 7: Thu Jan 31 00:00:00 CST 2008
- IE 8: Beta 2: Thu Jan 31 00:00:00 CST 2008
- Opera 8.54: Thu, 31 Jan 2008 00:00:00 GMT-0600
- Opera 9.27: Thu, 31 Jan 2008 00:00:00 GMT-0600
- Opera 9.60: Thu Jan 31 2008 00:00:00 GMT-0600
- Firefox 2.0.0.17: Thu Jan 31 2008 00:00:00 GMT-0600 (Canada Central Standard Time)
- Firefox 3.0.3: Thu Jan 31 2008 00:00:00 GMT-0600 (Canada Central Standard Time)
- Google Chrome 0.2.149.30: Thu Jan 31 2008 00:00:00 GMT-0600 (Canada Central Standard Time)
- Safari for Windows 3.1.2: Thu Jan 31 2008 00:00:00 GMT-0600 (Canada Central Standard Time)
- int_d = new Date(2008, 11+1,1);
- d = new Date(int_d - 1);
- function daysInMonth(iMonth, iYear)
- {
- return 32 - new Date(iYear, iMonth, 32).getDate();
- }
Add Comment
Please, Sign In to add comment