JS判断时间是否早晚于当前时间

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>时间判断</title>
</head>
<body>
    <script type="text/javascript" >
        var thetime = '2018-04-17 19:09:00';
        var   d=new   Date(Date.parse(thetime .replace(/-/g,"/")));

        var   curDate=new   Date();
        if(d <=curDate){
            alert("小于当前时间");
        }else{
            alert("大于当前时间");
        }
    </script>
</body>
</html>
阅读更多

没有更多推荐了,返回首页