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()
メソッドは、協定世界時に基づき、指定された日時の「分」を返します。
試してみましょう
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
// Expected output: 15
console.log(date2.getUTCMinutes()); // 31 Dec 1999 23:45:30 GMT
// Expected output: 45
構文
js
getUTCMinutes()
返値
数値です。
もし Date
オブジェクトが有効な日時を表している場合は、0 から 59 までの整数で、指定された日時の世界時での分の値を表します。
それ以外の場合は、Date
オブジェクトが有効な日時を表していなければ NaN
が返されます。
例
getUTCMinutes() の使用
次の例は、現在時刻の「分」部を変数 minutes
に代入します。
js
const today = new Date();
const minutes = today.getUTCMinutes();
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getutcminutes |
ブラウザーの互換性
BCD tables only load in the browser