Date.prototype.getUTCMinutes()
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.
getUTCMinutes()
は Date
インスタンスのメソッドで、協定世界時に基づき、指定された日時の「分」を返します。
試してみましょう
const date1 = new Date("1 January 2000 03:15:30 GMT+07:00");
const date2 = new Date("1 January 2000 03:15:30 GMT+03:30");
console.log(date1.getUTCMinutes()); // 31 Dec 1999 20:15:30 GMT
// 予想される結果: 15
console.log(date2.getUTCMinutes()); // 31 Dec 1999 23:45:30 GMT
// 予想される結果: 45
構文
js
getUTCMinutes()
引数
なし。
返値
指定された日時の、協定世界時に基づく「分」を表す 0 から 59 までの整数です。日時が無効な場合は NaN
を返します。
例
getUTCMinutes() の使用
次の例は、現在時刻の「分」部を変数 minutes
に代入します。
js
const today = new Date();
const minutes = today.getUTCMinutes();
仕様書
Specification |
---|
ECMAScript® 2026 Language Specification # sec-date.prototype.getutcminutes |