How to get the Day of the Month in JavaScript


Borislav Hadzhiev

Last updated: Oct 24, 2021


Photo from Unsplash

Get the Day of the Month in JavaScript #

To get the day of the month, use the new Date() constructor to create a date object and call the getDate() method on the result, e.g. new Date().getDate(). The getDate method returns an integer between 1 and 31 that represents the day of the month for a given date.

// 👇️ Current day of month const currentDayOfMonth = new Date().getDate(); console.log(currentDayOfMonth); // 👇️ Day of month for specific date const date = new Date(2025, 01, 24); const dayOfMonth = date.getDate(); console.log(dayOfMonth); // 👉️ 24

We used the new Date() constructor to get a date object, on which we can use the getDate method.

The get date method returns the day of the month (1-31) for a specific date.

If you need to get the current day of the month, don't pass any parameters to the new Date() constructor, when calling the getDate() method.

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.