How to check if one DateTime is later than another in javascript

Asuming you received a date in Javascript Date format you need Date.parse() function or compare by comparison operators. It will return the milliseconds that have passed since 01/01/1970 00:00

Somehow like this:

if(Date.parse(datetimeStart) < Date.parse(datetimeEnd)){
   //start is less than End
}else{
   //end is less than start
}

Here is a Fiddle


its really simple in javascript

var startTime = new Date('01/12/2013 12:00:00 AM');
var endTime = new Date('02/12/2013 12:00:00 AM');

and then all you need to do is compare

if( startTime < endTime){
   alert("start time is lesser");
}

More on this here


Try this following code:

function dateCheck() {
    var fDate = new Date("26/05/2013");
    var lDate = new Date("24/05/2013");
    if(fDate <= lDate) {
        alert("true");
        return true;
    }
    alert("false");
    return false;
}