Hey All,
How can obtain the last day of the month with the timestamp being 11:59:59 PM?
Thanks, rodchar
Hey All,
How can obtain the last day of the month with the timestamp being 11:59:59 PM?
Thanks, rodchar
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)
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));