Share via


getUTCFullYear Method (Windows Scripting - JScript)

 

Returns the year value in a Date object using Universal Coordinated Time (UTC).

Syntax

dateObj.getUTCFullYear() 

Remarks

The required dateObj reference is a Date object.

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

The getUTCFullYear method returns the year as an absolute number. This avoids the year 2000 problem where dates beginning with January 1, 2000 are confused with those beginning with January 1, 1900.

The following example illustrates the use of the getUTCFullYear method.

function UTCDateDemo(){
   var d, s = "Today's UTC date is: ";
   d = new Date();
   s += (d.getUTCMonth() + 1) + "/";
   s += d.getUTCDate() + "/";
   s += d.getUTCFullYear();
   return(s);
}

Requirements

Version 3

Applies To: Date Object (Windows Scripting - JScript)

See Also

getFullYear Method (Windows Scripting - JScript)
setFullYear Method (Windows Scripting - JScript)
setUTCFullYear Method (Windows Scripting - JScript)