有时前后端交互需要传递时间戳。获取时间戳的方法如下:
console.log( Date.parse(new Date()) ) // 1574318285000 精确到秒 console.log( (new Date()).valueOf() ) // 1574318285290 精确到毫秒 console.log( new Date().getTime()) // 1574318285290 精确到毫秒
有时前后端交互需要传递时间戳。获取时间戳的方法如下:
console.log( Date.parse(new Date()) ) // 1574318285000 精确到秒 console.log( (new Date()).valueOf() ) // 1574318285290 精确到毫秒 console.log( new Date().getTime()) // 1574318285290 精确到毫秒
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。