JavaScript Date setUTCDate() Method
- Previous Page setTime()
- Next Page setUTCFullYear()
- Go to the Previous Level JavaScript Date Reference Manual
Definition and Usage
setUTCDate()
The method sets the date of the month according to UTC time.
Tip:Coordinated Universal Time (UTC) is the time set by the world time standard.
Note:UTC time is the same as GMT time (Greenwich Mean Time).
Example
Example 1
Set the date of the month according to UTC:
var d = new Date(); d.setUTCDate(15);
Example 2
Set the last day of the previous month for the day of the current month:
var d = new Date(); d.setUTCDate(0);
Example 3
Set a specific date for the day of the month:
var d = new Date("July 21, 1983 01:15:00"); d.setUTCDate(15);
Syntax
Date.setUTCDate(day)
Parameter Value
Parameter | Description |
---|---|
day |
Required. An integer representing the day of the month. Expected value is 1-31, but other values are allowed:
If a month has 31 days:
If a month has 30 days:
|
Technical Details
Return Value: | A numerical value representing the number of milliseconds between the Date object and midnight on January 1, 1970. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
setUTCDate() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Date Setting Methods
- Previous Page setTime()
- Next Page setUTCFullYear()
- Go to the Previous Level JavaScript Date Reference Manual