getDate method
The getDate method is applied
to the date object
and returns the number of the current
day of the month. Day numbering starts
from 1.
Syntax
date.getDate();
Example
Let's output the number of the current day:
let date = new Date();
let res = date.getDate();
console.log(res);
Example
Let's output the day for the given date:
let date = new Date(2025, 11, 31);
let res = date.getDate();
console.log(res);
The code execution result:
31
See also
-
the
getDaymethod
that gets the day of the week -
the
getFullYearmethod
that gets the year -
the
getMonthmethod
that gets the month -
the
getDatemethod
that gets the day of the month -
the
getHoursmethod
that gets the hours -
the
getMinutesmethod
that gets the minutes -
the
getSecondsmethod
that gets the seconds -
the
getMillisecondsmethod
that gets the milliseconds