JavaScript Date getUTCFullYear() method

The JavaScript date getUTCFullYear() method returns the year for the specified date on the basis of universal time.

Syntax

The getUTCFullYear() method is represented by the following syntax:

Return

A number that represents the year.

JavaScript Date getUTCFullYear() method example

Here, we will understand getUTCFullYear() method through various examples.

Example 1

Let's see an example to print the value of the current year according to universal time.

Test it Now

Output:

Year value : 2018

Example 2

Let's see an example to print the year from the given date according to universal time.

Test it Now

Output:

Year value1 : 1947
Year value2 : 1948
Next TopicJavaScript Date




Latest Courses