Share via


getFullYear Method (JScript 5.6) 

Returns the year value in the Date object using local time.


dateObj.getFullYear() 

Remarks

The required dateObj reference is a Date object.

To get the year using Universal Coordinated Time (UTC), use the getUTCFullYear method.

The getFullYear method returns the year as an absolute number. For example, the year 1976 is returned as 1976. This avoids the year 2000 problem where dates beginning with January 1, 2000 are confused with those beginning with January 1, 1900.

Example

The following example illustrates the use of the GetFullYear method.

function DateDemo(){

   var d, s = "Today's UTC date is: ";

   d = new Date();

   s += (d.getMonth() + 1) + "/";

   s += d.getDate() + "/";

   s += d.getFullYear();

   return(s);

}

Requirements

Version 3

Applies To: Date Object (JScript 5.6)

See Also

Reference

getUTCFullYear Method (JScript 5.6)
setFullYear Method (JScript 5.6)
setUTCFullYear Method (JScript 5.6)