• 查看当前时间是否在设定日期之前


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>判断当前是时间是否在设定时间之前</title>
    </head>
    <body>
    <script type="text/javascript">
    (function(){
    var currentDate = new Date();
    var year = currentDate.getFullYear();//
    var month = currentDate.getMonth()+1;//
    var day = currentDate.getDate();//
    var hour = currentDate.getHours();//
    var minute = currentDate.getMinutes();//
    var second = currentDate.getSeconds();//
    var millisecond = currentDate.getMilliseconds();//毫秒
    console.log("currentDate:"+currentDate);
    console.log("年:"+year+"
    月:"+month+"
    日:"+day+"
    时:"+hour+"
    分:"+minute+"
    秒:"+second+"
    毫秒:"+millisecond);
    console.log(""+year+month+day+hour);
    if(year>2018){
    expired()
    }else if(month>9){
    expired()
    }else if(month==9&&day>24){
    expired()
    }
    function expired(){
    console.log('该时间在设定时间之后,已过期');
    return false;
    }
    })()
    </script>
    </body>
    </html>
  • 相关阅读:
    CentOS7 安装 mysql
    redis简介以及redis集群配置
    分布式布局简述
    字符串
    接口
    接口回调
    java关键字之static
    java关键字之final
    java关键字之abstract
    memcache的配置
  • 原文地址:https://www.cnblogs.com/llllpzyy/p/9688792.html
Copyright © 2020-2023  润新知