YouTip LogoYouTip

Jsref Setutcfullyear

# JavaScript setUTCFullYear() Method [![Image 8: Date Object Reference Manual](#) JavaScript Date Object](#) ## Example Set the year to 1992: var d = new Date(); d.setUTCFullYear(1992); _d_ Output: Thu Jun 18 1992 03:13:57 GMT+0000 (Coordinated Universal Time) [Try it Β»](#) * * * ## 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 Time, World Standard Time, International Coordinated Time, abbreviated as UTC (Universal Coordinated Time). **Note:** UTC time is the same as GMT (Greenwich Mean Time). * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) All major browsers support the setUTCFullYear() method. * * * ## Syntax _Date_.setUTCFullYear(_year_,_month_,_day_) ## Parameter Values | Parameter | Description | | :--- | :--- | | _year_ | Required. The value to set the year field of the dateObject to. This parameter should be a full year with century, like 1999, not just an abbreviated year value like 99. | | _month_ | Optional. The value to set the month field of the dateObject to. Uses Coordinated Universal Time (UTC). This parameter is an integer between 0 and 11: * -1 is the last month of the previous year * 12 is the first month of the next year * 13 is the second month of the next year | | _day_ | Optional. The value to set the day field of the dateObject to. Uses Coordinated Universal Time (UTC). This parameter is an integer between 1 and 31: * 0 is the last hour of the previous month. * -1 is the hour before the last hour of the previous month 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 between January 1, 1970 and the adjusted date. | ## Technical Details | JavaScript Version: | 1.3 | | --- | * * * ## More Examples ## Example 2 Set the date to October 3, 2020: var d = new Date(); d.setUTCFullYear(2020,10,3); _d_ Output: Tue Nov 03 2020 03:13:57 GMT+0000 (Coordinated Universal Time) [Try it Β»](#) ## Example Set the date to 6 months ago according to Coordinated Universal Time (UTC): var d=new Date(); d.setUTCFullYear(d.getUTCFullYear,d.getUTCMonth()-6); _d_ Output: Thu Dec 18 2025 03:13:57 GMT+0000 (Coordinated Universal Time) [Try it Β»](#)
← Jsref SetutchoursJsref Getmonth β†’