//获取当前时间 function FormatDate () { var now = new Date(); var year = now.getFullYear(); var month = now.getMonth(); var date = now.getDate(); month = month + 1; if (month < 10){ month = "0" + month; } if (date < 10) { date = "0" + date; } var time = year + "-" + month + "-" + date; return time; }
var today_time = FormatDate(); if(today_time >= '2019-07-29'){ alert("活动已结束"); }