JavaScript Date getMonth () Method - W3Schools
Description getMonth() returns the month (0 to 11) of a date. January =0, February = 1, ... (see below):
Searching…
Description getMonth() returns the month (0 to 11) of a date. January =0, February = 1, ... (see below):
The getMonth() method of Date instances returns the month for this date according to local time, as a zero-based value (where zero indicates the first month of the year).
If getMonth() returned 1-12, then programmers would have to do d.getMonth()-1 everytime they wanted a fancy named month. Days of the month don't have specific "names" per se.
Jul 11, 2025 · It returns the Month for the given Date object. The month is an integer value ranging from 0 to 11. Zero (0) means January, 1 means February, and so on till 11 means December. Example 1: Extracting Mont...
Learn how to use the JavaScript Date getMonth () method to retrieve the month from a date object. Understand its syntax, usage, and examples.
Mar 6, 2024 · To get the correct return value from Date.getMonth(), add 1 to the result, e.g. date.getMonth() + 1. The getMonth method returns a zero-based number between 0 and 11, where 0 is January and 11 is December.
Mar 17, 2025 · To get the month number from a JavaScript Date object, you can use the getMonth() method. The getMonth() method returns a zero-based index representing the month of the date, where January is 0 and Dece...
Feb 5, 2025 · A comprehensive guide to the JavaScript Date getMonth () method, detailing its syntax, usage, and providing practical examples.
Apr 5, 2023 · The JavaScript getMonth () method is a built-in function that is used to get the month value from a date object. It returns an integer value ranging from 0 to 11, where 0 represents January and 11 repres...
getMonth() function is zero indexed based. You need to do d1.getMonth() + 1. Recently I used Moment.js library and never looked back. Try it! Can you say how did you use? dayjs is also a good alternative. I suspect th...