JavaScript getDate() Method
Example
Return the day of the month:
var d = new Date();
var n = d.getDate();
n Output result:
var d = new Date() document.write(d.getDate())
Try it »
Definition and Usage
The getDate() method returns the day of the month.
Browser support





All major browsers support the getDate() method.
Syntax
Date
.getDate()
Return Value
| Type | Description |
|---|---|
| Number | The day of the month indicated by dateObject, using local time. The return value is an integer between 1 and 31. |
Technical Details
| JavaScript version: | 1.1 |
|---|
More examples
Example
Return the day of the month for a specified time:
var d = new Date("July 21, 1983 01:15:00");
var n = d.getDate();
Output result:
21
Try it »
JavaScript Date object