Possible Duplicate:
Compare 2 dates with JavaScript
Compare two dates in JavaScript
I am new to jQuery and I want to compare two dates,
e.g. var date1 = '2011-01-12';
var date2 = '2011-01-15';
I tried but could't find a solution.
Possible Duplicate:
Compare 2 dates with JavaScript
Compare two dates in JavaScript
I am new to jQuery and I want to compare two dates,
e.g. var date1 = '2011-01-12';
var date2 = '2011-01-15';
I tried but could't find a solution.
Because you've got the dates in a YYYY-MM-DD
format, you can simply do string comparison;
if (date1 < date2) //
else if (date1 == date2) //
Aside from that, see the dupes.