Easy Tutorial
❮ Prop Tabledata Choff Met Document Normalizedocument ❯

JavaScript setUTCFullYear() Method

JavaScript Date Object

Example

Set the year to 1992:

d Output result:


Definition and Usage

The setUTCFullYear() method is used to set the year according to Coordinated Universal Time (UTC).

Note: Coordinated Universal Time, also known as Universal Coordinated Time, World Standard Time, and International Coordinated Time, is abbreviated as UTC.

Note: UTC time is the same as GMT (Greenwich Mean Time).


Browser Support

All major browsers support the setUTCFullYear() method.


Syntax

Parameter Values

Parameter Description
year Required. The value to set for the year field of the dateObject. <br>This parameter should be the full year including the century, such as 1999, not just the abbreviated year, like 99.
month Optional. The value to set for the month field of the dateObject, using UTC. This parameter is an integer between 0 and 11: -1 represents the last month of the previous year, <br>12 represents the first month of the next year, <br>13 represents the second month of the next year.
day Optional. The value to set for the day field of the dateObject, using UTC. This parameter is an integer between 1 and 31: 0 represents the last day of the previous month, <br>-1 represents the day before the last day of the previous month. If the current month has 31 days: 32 represents the first day of the next month. If the current month has 30 days: 32 represents 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 2

Set the date to October 3, 2020:

d Output result:

Example

Set the date to 6 months ago according to Coordinated Universal Time (UTC):

d Output result:


JavaScript Date Object

❮ Prop Tabledata Choff Met Document Normalizedocument ❯