Date.prototype.getUTCMonth()

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.

getUTCMonth()Date インスタンスのメソッドで、協定世界時に基づき、指定された日時の「月」を表す 0 を基点とした値(すなわち 0 が年の最初の月を示す)を返します。

試してみましょう

const date1 = new Date("December 31, 1975, 23:15:30 GMT+11:00");
const date2 = new Date("December 31, 1975, 23:15:30 GMT-11:00");

// December
console.log(date1.getUTCMonth());
// 予想される結果: 11

// January
console.log(date2.getUTCMonth());
// 予想される結果: 0

構文

js
getUTCMonth()

引数

なし。

返値

指定された日時の、協定世界時に基づく「月」を表す 0 から 11 までの整数です。1 月ならば 0、 2 月ならば 1 となります。日時が無効な場合は NaN を返します。

getUTCMonth() の使用

次の例は、現在日時の「月」の部分を変数 month に代入します。

js
const today = new Date();
const month = today.getUTCMonth();

仕様書

Specification
ECMAScript® 2026 Language Specification
# sec-date.prototype.getutcmonth

ブラウザーの互換性

関連情報