how to compare time in javascript code example

Example 1: compare date and time in js

var isLarger = new Date("2-11-2012 13:40:00") > new Date("01-11-2012 10:40:00");

Example 2: date compare in js

var x = new Date('2013-05-23');
var y = new Date('2013-05-23');

// less than, greater than is fine:
x < y; => false
x > y; => false
x === y; => false, oops!

// anything involving '=' should use the '+' prefix
// it will then compare the dates' millisecond values
+x <= +y;  => true
+x >= +y;  => true
+x === +y; => true