首页 新闻 赞助 找找看

在angualr2中如何比较两个时间的大小,new date(),方法,,

1
悬赏园豆:5 [已关闭问题] 关闭于 2017-09-25 19:55

就是我i想在后台设置一个过期时间,当系统时间超过了我们设置的时间,所有的数据都清空为零,这个该怎么实现呢?有没有大神会的

海染蓝了天LE的主页 海染蓝了天LE | 初学一级 | 园豆:26
提问于:2017-09-13 19:59
< >
分享
所有回答(1)
0
<scripttype="text/javascript"language="javascript">
 
   function CompareDate() {
       //            new Date(Year, Month, Date, Hr, Min, Sec);
       var dateOne = new Date(2012, 04, 20, 14, 55, 59);
       var dateTwo = new Date(2012, 04, 20, 12, 10, 20);
        //Note: 04 is month i.e. May
       if (dateOne > dateTwo) {
            alert("Date One is greather then Date Two.");
        }else {
            alert("Date Two is greather then Date One.");
        }
    }
 
    CompareDate();
</script>
爱编程的大叔 | 园豆:30839 (高人七级) | 2017-09-13 23:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册