Date getUTCFullYear() Method - Javascript Date

Javascript examples for Date:getUTCFullYear


The getUTCFullYear() method returns the year in four digits for dates between year 1000 and 9999, according to universal time.

UTC time is the same as GMT time.



Return Value:

A Number, representing the year

The following code shows how to return the year, according to universal time:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {/*from   w w  w. j  a  va 2 s  .com*/
    var d = new Date("July 21, 2020 01:15:00");
    var n = d.getUTCFullYear();
    document.getElementById("demo").innerHTML = n;


Related Tutorials