how to compare two string dates in javascript?

The Solution to how to compare two string dates in javascript? is


var d1 = Date.parse("2012-11-01");
var d2 = Date.parse("2012-11-04");
if (d1 < d2) {
    alert ("Error!");
}

Demo Jsfiddle

~ Answered on 2013-02-08 20:57:33


Most Viewed Questions: