The getUTCFullYear() method returns the year as four digits for dates between year 1000 and 9999 of the date object, according to universal time.
The getUTCFullYear() method returns the year as four digits for dates between year 1000 and 9999 of the date object, according to universal time.
UTC time is the same as GMT time.
Date.getUTCFullYear()
None
A Number, representing the year
Return the year, according to universal time:
//display the year, according to UTC. var d = new Date(); var n = d.getUTCFullYear(); console.log(n);/*from w ww . ja v a 2 s.co m*/ //Return the UTC year of a specific date: //display the year of a specific date, according to UTC. var d = new Date("July 21, 2010 01:15:00"); var n = d.getUTCFullYear(); console.log(n);