Date.prototype.getUTCMilliseconds()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
getUTCMilliseconds()
メソッドは、協定世界時に基づき、指定された日時の「ミリ秒」を返します。
試してみましょう
const exampleDate = new Date("2018-01-02T03:04:05.678Z"); // 2 January 2018, 03:04:05.678 (UTC)
console.log(exampleDate.getUTCMilliseconds());
// Expected output: 678
構文
js
getUTCMilliseconds()
返値
例
getUTCMilliseconds() の使用
次の例は、現在時刻の「ミリ秒」部を変数 milliseconds
に代入します。
js
const today = new Date();
const milliseconds = today.getUTCMilliseconds();
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getutcmilliseconds |
ブラウザーの互換性
BCD tables only load in the browser