JavaScriptDategetMonth

Returns the month (0-11) in the specified date.

Syntax

date.getMonth()

Example

Enter values below to update the example in real time.

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)