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

javascriptdate.getDate();

Example

Let's output the number of the current day:

javascriptlet date = new Date();
let res = date.getDate();

console.log(res);

Example

Let's output the day for the given date:

javascriptlet date = new Date(2025, 11, 31);
let res = date.getDate();

console.log(res);

The code execution result:

javascript31

See also