Date.prototype.getMilliseconds()
getMilliseconds()
方法基於本地時區回傳指定日期的毫秒數。
嘗試一下
語法
getMilliseconds()
返回值
一個基於本地時區表示指定日期的毫秒數、介於 0 至 999 的整數值。
範例
使用 getMilliseconds()
下列範例將當前時間的毫秒數指派給變數 milliseconds
。
const today = new Date();
const milliseconds = today.getMilliseconds();
規範
Specification |
---|
ECMAScript Language Specification # sec-date.prototype.getmilliseconds |
瀏覽器相容性
BCD tables only load in the browser