This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getUTCFullYear

Summary

Gets the year using Universal Coordinated Time (UTC).

Syntax

dateObj.getUTCFullYear()

Return Value

Returns the year as a four-digit number. Years specified as two digits in the Date constructor or in setFullYear are assumed to be in the twentieth century, so given "5/14/12", getUTCFullYear returns "1912".

Examples

The following example shows how to use the getUTCFullYear method.

var date = new Date("1/9/36");
 document.write(date.getUTCFullYear());

 // Output: 1936

Remarks

The required dateObj reference is a Date object. To get the year using local time, use the getFullYear method.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article