I wanted to compare two dates which are in below format:
9/10/2014 5:22 PM
I have two such dates and i want to compare them.
For that i have written below code:
var StartDateTime = ($("#dtpStartDate").data("kendoDateTimePicker")).value().toLocaleString("en-US");
var currentDateTime = new Date();
if (StartDateTime < currentDateTime.toLocaleString()) {
alert("StartDateTime is less");
flagValidation = false;
}
else {
alert("StartDateTime is large");
}
But actually when StartDateTime is less than currentdatetime then also Its showing alert "StartDateTime is large".
Please help me.
How can i compare the dates correctly?
if($("#dtpStartDate").data("kendoDateTimePicker")).value() < currentDateTime)instead