Date.prototype.getMonth
Returns the month — a number from 0 to 11.
Available since: ES1
Syntax
date.getMonth()Return value
numberThe month number from 0 (January) to 11 (December).
Examples
March is 2, not 3:
const date = new Date(2026, 2, 15);
console.log(date.getMonth());
console.log(date.getMonth() + 1);Output:
2
3The month name from an array:
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
console.log(months[new Date(2026, 2, 15).getMonth()]);Output:
MarNotes
To show the month number to a person, add 1. A month name in any language is easier to get from toLocaleDateString() with the month option.
See also
- Date.prototype.getFullYear — Returns the year.
- Date.prototype.getDate — Returns the day of the month.
- Date.prototype.setMonth — Sets the month.
Related recipes
In the tutorial
- Dates and time — The Date object in JavaScript: creating a date, reading the year, month and day, changing a date, the difference between dates and the ISO format.