【轉】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;
            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM