JavaScript日付getMonth

月を返します(0〜11、0 が 1 月)。

構文

date.getMonth()

使用例

下記の値を入力するとサンプルに即時反映されます。

const
new
June
console
getMonth
Jan
Jun
const date = new Date(2024, 5, 15);   // June 15
console.log(date.getMonth());   // 5 (0=Jan, 5=Jun)