How to get the Day of the Month in JavaScript

avatar

Borislav Hadzhiev

Sun Oct 24 20211 min read

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.

index.js
// ๐Ÿ‘‡๏ธ 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 #

Join my newsletter

I'll send you 1 email a week with links to all of the articles I've written that week

Buy Me A Coffee