JavaScript setUTCDate() Method
Example
Set a certain day of the month according to Universal Time (UTC):
var d = new Date();
d.setUTCDate(15);
d Output result:
Try it »
Definition and Usage
The setUTCDate() method is used to set a certain day of the month according to Universal Time (UTC).
**Note:** Coordinated Universal Time, also known as Universal Time, Universal Standard Time, or International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
**Note:** UTC time is the same as GMT (Greenwich) time.
Browser support





All major browsers support the setUTCDate() method.
Syntax
Date
.setUTCDate(
day
)
Parameter value
| Parameters | Description |
|---|---|
| day | Required. A certain day of the month to set for dateObject, expressed in universal time.
This parameter is an integer between 1 and 31: |
If the current month has 31 days:
- 32 is the first day of the next month.
If the current month has 30 days:
- 32 is the second day of the next month
Return Value
| Type | Description |
|---|---|
| Number | The number of milliseconds from January 1, 1970 to 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 Output result:
Try it »
Example
Set a certain day of the month:
var d = new Date("July 21, 1983 01:15:00");
d.setUTCDate(15);
d Output result:
Try it »
JavaScript Date object