Date.prototype.getMilliseconds()
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.
getMilliseconds()
メソッドは、地方時に基づき、指定された日時の「ミリ秒」を返します。
試してみましょう
const moonLanding = new Date("July 20, 69 00:20:18");
moonLanding.setMilliseconds(123);
console.log(moonLanding.getMilliseconds());
// Expected output: 123
構文
js
getMilliseconds()
返値
地方時に基づき、指定された日時の「ミリ秒」を表す 0 から 999 までの間の数値。
例
getMilliseconds() の使用
次の例は、現在時刻のミリ秒部を変数 milliseconds
に代入します。
js
const today = new Date();
const milliseconds = today.getMilliseconds();
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getmilliseconds |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getMilliseconds |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.