From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Date Object
The setUTCFullYear() method is used to set the year according to Universal Coordinated Time (UTC).
| dateObject.setUTCFullYear(year,month,day) |
| Parameter | Description |
|---|---|
| year | Required. A four-digit value representing the year |
| month | Optional. A numeric value between 0 and 11 representing the month |
| day | Optional. A numeric value between 1 and 31 representing the date |
Note: This method is always used in conjunction with a Date object.
Tip: The Universal Coordinated Time (UTC) is the time set by the World Time Standard.
Example 1Set the year to 1992 with setUTCFullYear():
The output of the code above will be: Try it yourself » |
Example 2Set the date to November 3, 1992 with setUTCFullYear():
The output of the code above will be: Try it yourself » |
JavaScript Date Object
From http://www.w3schools.com (Copyright Refsnes Data)