标签:时间比较
function check_date()
{
var beginTime=$(‘#examStartTime‘).val();
var endTime=$(‘#examEndTime‘).val();
var beginTimes = beginTime.substring(0, 10).split(‘-‘);
var endTimes = endTime.substring(0, 10).split(‘-‘);
beginTime = beginTimes[1] + ‘-‘ + beginTimes[2] + ‘-‘ + beginTimes[0] + ‘ ‘ + beginTime.substring(10, 19);
endTime = endTimes[1] + ‘-‘ + endTimes[2] + ‘-‘ + endTimes[0] + ‘ ‘ + endTime.substring(10, 19);
var a = (Date.parse(endTime) - Date.parse(beginTime)) / 3600 / 1000;
if (a <= 0) {
alert("开始时间必须小于结束时间");
return false;
} else {
return true;
}
}
标签:时间比较
原文地址:http://hatch.blog.51cto.com/9349645/1651387