JavaScript getDate()Method
Example
Return the day of the month:
var d = new Date();
var n = d.getDate();
var n = d.getDate();
nOutput:
var d = new Date()
document.write(d.getDate())
Try it yourself »
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 for the specified 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 the specified time:
var d = new Date("July 21, 1983 01:15:00");
var n = d.getDate();
var n = d.getDate();
Output:
21
Try it yourself »
Other Extensions
JavaScript Date Object