比较日期的大小 yyyy-MM-dd
function checkDateDiff(fromDate, toDate) { var dtArrTo = toDate.split('-'); var dtFrom = new Date(eval(dtArrFrom[0]),eval(dtArrFrom[1])-1,eval(dtArrFrom[2]), 0, 0, 0, 0) if (dtFrom.getTime() > dtTo.getTime()) { return true;
|
比较日期的大小 yyyy-MM-dd HH:mm:ss
function checkDateTimeDiff(fromDateTime, toDateTime) {
var retvalue=true; var fromArr = fromDateTime.split(' '); var fromDate = fromArr[0]; var fromTime = fromArr[1]; var toArr = toDateTime.split(' '); var toDate = toArr[0]; var toTime = toArr[1]; var dtArrFrom = fromDate.split('-'); var dtArrTo = toDate.split('-'); var timeArrFrom = fromTime.split(':'); var timeArrTo = toTime.split(':'); var dtFrom = new Date(eval(dtArrFrom[0]),eval(dtArrFrom[1])-1,eval(dtArrFrom[2]), eval(timeArrFrom[0]), eval(timeArrFrom[1]), eval(timeArrFrom[2]), 0); return false; return true;
|