I have two timestamps formats say,
a='2014-01-15 00:00:00.0'
b='2014-01-16 00:00:00.0'
How to compare and find if b is after a or not?
You may need to do something like this,
d1 = new Date("2014-01-15 00:00:00.0");
d2 = new Date("2014-01-16 00:00:00.0");
if ((d1 - d2) == 0) {
alert("equal");
} else if (d1 > d2) {
alert("d1 > d2");
} else {
alert("d1 < d2");
}
var a ='2014-01-15 00:00:00.0';
var b ='2014-01-16 00:00:00.0';
if (b > a) {
// do stuff
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With