Get first 3 Letters of a Month's Name in JavaScript

avatar

Borislav Hadzhiev

Last updated: Oct 25, 2021

banner

Photo from Unsplash

Get the first 3 Letters of a Month's Name #

Use the toLocaleString() method to get the first 3 letters of a month's name. The method accepts an options object, where if the month property is set to short, the return value is the first 3 letters of the month's name.

index.js
const date = new Date(2025, 03, 16); const shortName = date.toLocaleString('en-US', {month: 'short'}); console.log(shortName); // 👉️ Apr const narrowName = date.toLocaleString('en-US', {month: 'narrow'}); console.log(narrowName); // 👉️ A const longName = date.toLocaleString('en-US', {month: 'long'}); console.log(longName); // 👉️ April

We used the toLocaleString method to get the first 3 letters of a month's name.

We passed the following parameters to the method:

  1. the locale - in which language the name of the month should be returned. You could set it to default, to use the user's browser preferences.
  2. the options object - we set the month setting to short to get the first 3 letters of the month's name. Other possible values are narrow and long.

If you want to change the language of the months name update the locale parameter. Here's an example using german locale.

index.js
const date = new Date(2025, 9, 16); const shortName = date.toLocaleString('de-DE', {month: 'short'}); console.log(shortName); // 👉️ Okt const narrowName = date.toLocaleString('de-DE', {month: 'narrow'}); console.log(narrowName); // 👉️ O const longName = date.toLocaleString('de-DE', {month: 'long'}); console.log(longName); // 👉️ Oktober

Further Reading #

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.