Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript getUTCFullYear() Method

JavaScript getUTCFullYear() Method

Date Object Reference JavaScript Date object

Example

Return the 4-digit year based on universal time (UTC):

var d = new Date();

var n = d.getUTCFullYear();

Result output:

Try it »


Definition and Usage

The getUTCFullYear() method returns the 4-digit year based on universal time (UTC).

Calculating dates with UTC is based on local time and date.

**Tip:** Coordinated Universal Time, also known as Universal Time, World Standard Time, or International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).

**Note:** UTC time is similar to GMT time.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the getUTCFullYear() method.


Syntax

Date

.getUTCFullYear()

Return Value

Type Description
Number A 4-digit number representing the year

Technical Details

JavaScript version: 1.3

More examples

Example

Return the UTC year of a specified time:

var d=new Date("July 21, 1983 01:15:00");

var n=d.getUTCFullYear();

nOutput result:

1983

Try it »


Date Object Reference JavaScript Date object