Sets the year of the UTC date

Description

setUTCFullYear(year)
Sets the year of the UTC date. The year must be given with four digits (2007 instead of just 07).

Example


      var myDate = new Date();
      //from  w  w  w  .  ja v a  2s .  c o m
      myDate.setUTCFullYear(2012);
      console.log(myDate.toString());
      

The code above generates the following result.





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window