Export (0) Print
Expand All

getUTCFullYear Method (Date) (JavaScript)

Gets the year using Universal Coordinated Time (UTC).

dateObj.getUTCFullYear() 

The required dateObj reference is a Date object.

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".

To get the year using local time, use the getFullYear method.

The following example shows how to use the getUTCFullYear method.

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

// Output: 1936

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Date Object (JavaScript)

Show:
© 2014 Microsoft