獲取自 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());