Date.getUTCFullYear() (Method)

Returns the UTC full year value for a date/time.

Availability:

ECMAScript edition - 2
JavaScript - 1.2
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Property/method value type:Number primitive
JavaScript syntax:-myDate.getUTCFullYear()

The year number for the receiving object normalized to UTC time coordinates. The result is a full 4 digit year number value based on the UTC time value.

Warnings:

Example code:

   <HTML>

   <HEAD></HEAD>

   <BODY>

   <SCRIPT>

   // Calculate which century from the year number

   myDate = new Date();

   myCentury = 1 + myDate.getUTCFullYear()/100;

   switch (myCentury % 10)

   {

   case 1 : mySuffix = "st";

   break;

   

   case 2 : mySuffix = "nd";

   break;

   

   case 3 : mySuffix = "rd";

   break;

   

   default : mySuffix = "th";

   break;

   

   }

   document.write(myCentury + mySuffix + " century");

   </SCRIPT>

   </BODY>

   </HTML>

See also:Date.prototype, Date.setUTCFullYear()

Cross-references:

ECMA 262 edition 2 - section - 15.9.5.7

ECMA 262 edition 3 - section - 15.9.5.11