Possible Duplicate:
Compare dates with JavaScript
I want to find which one is greater from 2 dates with time that is in the following format in javascript
date1=2-11-2012 13:40:00 date2=01-11-2012 10:40:00
Possible Duplicate:
Compare dates with JavaScript
I want to find which one is greater from 2 dates with time that is in the following format in javascript
date1=2-11-2012 13:40:00 date2=01-11-2012 10:40:00
Hopefully you can learn something...
Date
objects using the Date
constructor.valueOf()
, and what that means for a Date
object.>
).Then, you may come up with something like...
var isLarger = new Date("2-11-2012 13:40:00") > new Date("01-11-2012 10:40:00");
var x=new Date();
x.setFullYear(2100,0,14);
var y=new Date();
y.setFullYear(2100,0,20);
if (x>y)
{
alert("Message1");
}
else
{
alert("Message2");
}