Saturday, September 6, 2025
HomeLanguagesJavascriptJavaScript Date getUTCFullYear() Method

JavaScript Date getUTCFullYear() Method

The date.getUTCFullYear() method is used to fetch the year according to universal time from a given Date object.

Syntax:  

DateObj.getUTCFullYear();

Parameter: This method does not take any parameter. It is just used along with a Date Object from which we want to fetch the year according to universal time.

Return Values: It returns the year for the given date object DateObj according to universal time. 

Note: The DateObj is a valid Date object created using the Date() constructor from which we want to fetch the year according to universal time.

Example 1: Below is an example of the Date getUTCFullYear() method. 

javascript




// Here a date has been assigned according
// to universal time while creating Date object
let dateobj =
    new Date('October 15, 1996 05:35:32 GMT+11:00');
 
// year from above date object is
// being extracted using getUTCFullYear().
let B = dateobj.getUTCFullYear();
 
// Printing year according to universal time.
console.log(B);


Output: 

1996

Example 2: The date of the month should lie between 1 to 31 because none of the months have a date greater than 31 that is why it returns NaN i.e, not a number because the date for the month does not exist. If the date for the month does not exist, the year will also not be existed. 

javascript




// Here a date has been assigned according
// to universal time while creating Date object
let dateobj =
    new Date('October 45, 1996 05:35:32 GMT+11:00');
 
// Year from above date object is
// being extracted using getUTCFullYear().
let B = dateobj.getUTCFullYear();
 
// Printing year according to universal time.
console.log(B);


Output: 

NaN

Example 3: If nothing as a parameter is given to the Date() constructor, the getUTCFullYear() function returns the current year according to universal time. 

javascript




// Creating Date object
let dateobj = new Date();
 
// Year from above date object is
// being extracted using getUTCFullYear().
let B = dateobj.getUTCFullYear();
 
// Printing current year
// according to universal time.
console.log(B);


Output: 

2018

We have a complete list of Javascript Javascript Date methods, to check those please go through the Javascript Date Object Complete Reference article.

Supported Browsers: The browsers supported by the JavaScript Date getUTCFullYear() method are listed below: 

  • Google Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer 4 and above
  • Opera 4 and above
  • Safari 1 and above
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Previous article
Next article
RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11868 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS