Partager via


getFullYear Method (Windows Scripting - JScript)

 

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

Syntax

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.

The following example illustrates the use of the getFullYear method.

function DateDemo(){
   var d, s = "Today's date is: ";
   d = new Date();
   s += (d.getMonth() + 1) + "/";
   s += d.getDate() + "/";
   s += d.getFullYear();
   return(s);
}

Requirements

Version 3

Applies To: Date Object (Windows Scripting - JScript)

See Also

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