Latest web development tutorials

JavaScript getUTCFullYear () method

Date Object Reference JavaScript Date Object

Examples

According to Universal Time (UTC) returns a four-digit year table:

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

Results output:


try it"


Definition and Usage

getUTCFullYear () method returns a four-digit year according to Universal Time (UTC) representation.

UTC is calculated using the date method according to the local time and date.

Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).

Note: UTC time is similar to GMT time.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

getUTCFullYear () All major browsers support getUTCFullYear () method


grammar

Date .getUTCFullYear ()

return value

类型 描述
Number 代表年份的四位数字

technical details

JavaScript version: 1.3


More examples

Examples

Returns the specified time UTC year:

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

n output:

1983

try it"


Date Object Reference JavaScript Date Object