JavaScript Date.prototype.getMonth() Method
The getMonth() method returns the month of a date as a number from 0 (January) to 11 (December).
Description
The getMonth() method returns the month, counted from zero: January is 0 and December is 11. Add 1 when displaying it as a number. To get the month name, use toLocaleDateString() with { month: 'long' }.
The zero-based month numbering is a common source of off-by-one bugs, especially when building dates with new Date(year, month, day), where the month is zero-based too. ISO strings and most other systems number months from 1.
Like the other get...() methods without "UTC" in their name, it uses the time zone of the user's device, so the same moment can give different results for users in different places. Each has a getUTC...() counterpart for UTC, and for showing a date in a particular time zone, toLocaleString() with the timeZone option is the easiest approach.
Syntax
date.getMonth()Return Value
The month in local time, from 0 (January) to 11 (December).
Example
Browser Support
The following information will show you the current browser support for the Date.prototype.getMonth() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





