//var yourtime=document.getElementById('begin_time').value; var yourtime='2010-12-10 11:12'; yourtime = yourtime.replace("-","/");//替换字符,变成标准格式 var d2=new Date();//取今天的日期 var d1 = new Date(Date.parse(yourtime)); alert(d1); alert(d2); if(d1>d2){ alert("开始大于结束"); }
//var yourtime=document.getElementById('begin_time').value; var yourtime='2009-12-10'; yourtime = yourtime.replace(/-/g,"/");//替换字符,变成标准格式 var d2=new Date();//取今天的日期 var d1 = new Date(Date.parse(yourtime)); //alert(d1); //alert(d2); if(d1>d2){ alert("开始大于结束"); }