jquery - JavaScript validation to compare intime and outtime? -
jquery - JavaScript validation to compare intime and outtime? -
i have compare 2 timing 1 start time , sec end time of selected date start time less end time.
and have tried doesn't worked.
starttime="12:00 am"; endtime ="01:15 pm"; if(date.parse('01/01/2011 '+endtime) < date.parse('01/01/2011 '+starttime)) { alert("end time should exceed start time"); } else if(date.parse('01/01/2011 '+endtime) -date.parse('01/01/2011 '+starttime)==0) { alert("start time , end time cannot same"); }
try this.
var starttime ="12:00 am"; var endtime ="01:15 am"; var date1 = new date('01/01/2011 '+ starttime); var date2 = new date('01/01/2011 '+ endtime); if(date1 > date2) alert("end time should exceed start time"); if(date1.gettime() == date2.gettime()) alert("start time , end time cannot same");
javascript jquery html html5
Comments
Post a Comment