jsp获取当前时间
function time()
{
var now= new Date();
var year=now.getFullYear();
var month=now.getMonth();
var date=now.getDate();
//写入相应id
document.all("check.operateTime").value=+year+"-"+(month+1)+"-"+date;
//document.getElementById("info2").innerHTML="今天是:"+year+"年"+(month+1)+"月"+date+"日";
}
jsp判断日期大小
function duibi(a, b) {
var arr = a.split("-");
var starttime = new Date(arr[0], arr[1], arr[2]);
var starttimes = starttime.getTime();
var arrs = b.split("-");
var lktime = new Date(arrs[0], arrs[1], arrs[2]);
var lktimes = lktime.getTime();
if (starttimes > lktimes) {
//alert('开始时间大于离开时间,请检查');
return false;
}
else{
return true;}
}