Date.prototype.getDate
Returns the day of the month.
Available since: ES1
Syntax
date.getDate()Return value
numberThe day of the month from 1 to 31.
Examples
The day of the month:
console.log(new Date(2026, 2, 15).getDate());Output:
15The number of days in a month — day zero of the next month:
const daysInFebruary = new Date(2028, 2, 0).getDate();
console.log(daysInFebruary);Output:
29Notes
Do not confuse it with getDay(): that one returns the day of the week.
See also
- Date.prototype.getDay — Returns the day of the week — a number from 0 to 6, where 0 is Sunday.
- Date.prototype.setDate — Sets the day of the month — handy for adding and subtracting days.
- Date.prototype.getMonth — Returns the month — a number from 0 to 11.
Related recipes
In the tutorial
- Dates and time — The Date object in JavaScript: creating a date, reading the year, month and day, changing a date, the difference between dates and the ISO format.