Javascript Date getUTCFullYear()

Introduction

Javascript Date getUTCFullYear() returns the four-digit year according to universal time.

Return value

A number representing the year in the given date according to universal time.

let today = new Date();
let year = today.getUTCFullYear();
console.log(year);/*w  w w . j a v a 2s  . co m*/

Return the UTC year of a specific date:

var d = new Date("July 21, 2010 01:15:00");
var n = d.getUTCFullYear();
console.log(n);//from  www.ja  v a2  s  . c  o  m



PreviousNext

Related