js比较日期大小
//获取当前时间 var currentTime = new Date(); //自定义时间 var customTime="2019-03-01 00:00:00"; customTime= customTime.replace("-","/");//替换字符,变成标准格式 customTime= new Date(Date.parse(customTime)); if(currentTime < customTime){ alert("当前时间小于自定义时间"); } var oDate1 = new Date('2019-03-01'); var oDate2 = new Date('2019-03-01'); if(oDate1 > oDate2){ console.log('第一个大'); } else { console.log('第二个大'); }