js时间大小比较

xiaoxiao2021-03-01  33

根据时间对象的时间戳进行比较

var curTime = new Date().getTime(); // 当前时间的时间戳 当期时间2018-09-30 var strTime = "2018-10-01"; var strTimeDate = new Date(Date.parse(strTime .replace('/-/g','/'))).getTime(); // 国庆节时间戳 console.log(curTime );// 结果1538290614716 console.log(strTimeDate );// 结果1538352000000
转载请注明原文地址: https://www.6miu.com/read-4550236.html

最新回复(0)