Just use direct javascript functions
var fromdt="2013/05/29 12:30 PM"; var todt="2013/05/29 01:30 AM"; var from = new Date(Date.parse(fromdt)); var to = new Date(Date.parse(todt)); alert(from); alert(to) if (from > to){ alert("From"); }else{ alert("To"); }
After the date is parsed in the form of a date, you can do anything with it. And you can compare dates using standard operator signs (>, <etc)
I'm not sure what you need to do with them, but http://www.w3schools.com/jsref/jsref_obj_date.asp is a good link.
And heres crappy sandbox with the above code http://jsfiddle.net/QpFcW/
and the best that XX removed :( http://jsfiddle.net/QpFcW/1/
source share