views:

127

answers:

2

Hey All,

How can obtain the last day of the month with the timestamp being 11:59:59 PM?

Thanks, rodchar

+10  A: 
function LastDayOfMonth(Year, Month) {
    return new Date( (new Date(Year, Month,1))-1 );
}

Example:

> LastDayOfMonth(2009, 11)
Mon Nov 30 2009 23:59:59 GMT+0100 (CET)
The MYYN
+4  A: 

This will give you last day of current month.

var t= new Date();
alert(new Date(t.getFullYear(), t.getMonth() + 1, 0, 23, 59, 59));
Chetan Sastry