How to get the month name from a JavaScript date
By Flavio Copes
Learn how to get the month name from a JavaScript Date using the toLocaleString() method with the month long or short option, in any locale you want.
Given a JavaScript Date object instance, you can get the month name by calling its toLocaleString() method with the month option set to 'long'.
In other words, from
const today = new Date()
how can we get the month name?
Every Date object instance has a toLocaleString() method, which is one of the JavaScript internationalization methods.
Using it you can get the month name in your current locale, and here’s how you can use it:
const today = new Date()
today.toLocaleString('default', { month: 'long' })
Depending on your current locale you’ll get a different result. I get “October” as a result.
Using the short format for the month, I get “Oct”:
today.toLocaleString('default', { month: 'short' })
The first parameter, to which we pass the default string, is the locale. You can pass any locale you want, for example it-IT will return you ottobre:
const today = new Date()
today.toLocaleString('it-IT', { month: 'long' })
Formatting many dates
If you need the month name for a lot of dates, for example while rendering a list of blog posts, create an Intl.DateTimeFormat object once and reuse it:
const formatter = new Intl.DateTimeFormat('en-US', { month: 'long' })
formatter.format(new Date(2026, 7, 7)) // 'August'
formatter.format(new Date(2026, 11, 25)) // 'December'
It does the same job as toLocaleString(), but you pay the setup cost of the formatter only once instead of on every call.
Why not getMonth()?
The Date object also has a getMonth() method, and it’s a common source of confusion. It does not return a name. It returns a zero-based number:
const date = new Date(2026, 7, 7)
date.getMonth() // 7
That 7 means August, not July, because January is 0 and December is 11. Off-by-one bugs around getMonth() are very common.
If you catch yourself building an array of month names to look up with getMonth(), stop. That array only works for one language, and toLocaleString() already knows every month name in every locale. Let the platform do the work.
Related posts about js: