Date.prototype.getMinutes()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
getMinutes() は Date インスタンスのメソッドで、地方時に基づき、指定された日時の「分」を返します。
試してみましょう
const birthday = new Date("March 13, 08 04:20"); console.log(birthday.getMinutes()); // 予想される結果: 20 構文
js
getMinutes() 引数
なし。
返値
地方時に基づき、指定された日時の「分」を表す 0 から 59 までの間の数値です。日時が無効な場合は NaN を返します。
例
>getMinutes() の使用
変数 minutes には、 Date オブジェクト xmas95 に基づいて、 15 という値が入ります。
js
const xmas95 = new Date("1995-12-25T23:15:30"); const minutes = xmas95.getMinutes(); console.log(minutes); // 15 仕様書
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-date.prototype.getminutes> |