The Date object is also used to compare two dates.
The following example compares today's date with the 14th January 2011:
/* var myDate=new Date(); myDate.setFullYear(2011,0,14); var today = new Date(); if (myDate>today) { alert("Today is before 14th January 2011"); } else { alert("Today is after 14th January 2011"); } |
*/
No comments:
Post a Comment