获取自 1970 年 1 月 1 日 000000 UTC 以来经过的毫秒数

静态方法 Date.now 返回自 1970 年 1 月 1 日 00:00:00 UTC 以来经过的毫秒数。要使用 Date 对象的实例获取自那时起经过的毫秒数,请使用其 getTime 方法。

// get milliseconds using static method now of Date
console.log(Date.now());

// get milliseconds using method getTime of Date instance
console.log((new Date()).getTime());