Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Date.prototype.getMonth()

2 tags 1 category

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).

The return value of getMonth() is zero-based, which is useful for indexing into arrays of months, for example:

However, for the purpose of internationalization, you should prefer using Intl.DateTimeFormat with the options parameter instead.

Return value: An integer, between 0 and 11, representing the month for the given date according to local time: 0 for January, 1 for February, and so on. Returns NaN if the date is invalid.

Syntax example: getMonth()

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…