Tuesday, March 15, 2011

campare two dates in Javascript

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();
var today = new Date();

if (myDate>today)
  alert("Today is before 14th January 2011");
  alert("Today is after 14th January 2011");


No comments :

Post a Comment