JavaScript setUTCDate()Method
Example
Set the day of the month according to universal time (UTC):
var d = new Date();
d.setUTCDate(15);
d.setUTCDate(15);
dOutput:
Try it Yourself »
Definition and Usage
The setUTCDate() method sets the day of the month according to universal time (UTC).
Tip:Coordinated Universal Time, also known as World Unified Time, World Standard Time, International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
Note:UTC time is GMT (Greenwich) time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the setUTCDate() method.
Syntax
Date.setUTCDate(day)
Parameter Values
| Parameter | Description |
|---|---|
| day | Required. The day of the month to set for the dateObject, in universal time. The parameter is an integer between 1 and 31:
If this month has 31 days:
If this month has 30 days:
|
Return Value
| Type | Description |
|---|---|
| Number | The number of milliseconds between January 1, 1970 and the adjusted date. |
Technical Details
| JavaScript Version: | 1.3 |
|---|
More Examples
Example
Set the date to the last day of the previous month:
var d = new Date();
d.setUTCDate(0);
d.setUTCDate(0);
dOutput:
Try it Yourself »
Example
Set the day of the month:
var d = new Date("July 21, 1983 01:15:00");
d.setUTCDate(15);
d.setUTCDate(15);
dOutput:
Try it Yourself »
Other Extensions
JavaScript Date Object