生成的都是 13 位的时间戳。
通过多次测试 Date.parse(new Date()) 返回的13位时间戳 后3位总是000 只能精确到秒
使用:
var timestamp3 = new Date().getTime() 方法即可
var timestamp1 = Date.parse(new Date())
var timestamp2 = (new Date()).valueOf()
var timestamp3 = new Date().getTime()
var timestamp4 = Date.now()
var timestamp5 = +new Date()
console.log('timestamp1>>>',timestamp1)
console.log('timestamp1>typeof>>', typeof timestamp1)
console.log('timestamp2>>>',timestamp2)
console.log('timestamp2>typeof>>', typeof timestamp2)
console.log('timestamp3>>>',timestamp3)
console.log('timestamp3>typeof>>', typeof timestamp3)
console.log('timestamp4>>>',timestamp4)
console.log('timestamp4>typeof>>', typeof timestamp4)
console.log('timestamp5>>>',timestamp5)
console.log('timestamp5>typeof>>', typeof timestamp5)