JavaScript getUTCFullYear()Method

Date 对象参考手册JavaScript Date Object

Examples

Returns the four-digit year according to Universal Time (UTC):

var d = new Date();
var n = d.getUTCFullYear();

Result output:


Try it yourself »


Definition and Usage

The getUTCFullYear() method returns the four-digit year according to Universal Time (UTC).

The method of using UTC to calculate dates is based on the local time and date.

Tip:Coordinated Universal Time, also known as World Unified Time, World Standard Time, International Coordinating 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 four-digit number representing the year

Technical Details

JavaScript Version: 1.3


More Examples

Example

Returns the UTC year of the specified time:

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

nOutput result:

1983

Try it yourself »


Date 对象参考手册JavaScript Date Object

Other Extensions