Skip to content

几个获取时间戳的方式

Date 上的静态方法:

返回自1970年1月1日 00:00:00 UTC到当前时间的毫秒数

js
Date.now()

Date对象上的方法:

返回自1970年1月1日 00:00:00 UTC到该Date对象所表示时间的毫秒数

js
var d = new Date('2019/05/18')
console.log(d.getTime())

一天的毫秒数 246060*1000