【转】js 判断今天日期是否超过指定日期

方法函数:

function FormatDate (strTime) {
            var date = new Date(strTime);
            return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
        }

调用方法:

            var today = new Date();
            var today_time =  FormatDate(today);
            if(today_time>'2018-4-25'){
                alert('活动已结束');
                return false;
            }

猜你喜欢

转载自www.cnblogs.com/gushengyan/p/8947815.html