Core JavaScript 1.5 Reference:Global Objects:Date:setYear
From MDC
(Redirected from Core JavaScript 1.5 Reference:Objects:Date:setYear)
Deprecated
Contents |
[edit] Summary
Sets the year for a specified date according to local time.
| Method of Date | |
| Implemented in: | JavaScript 1.0, NES 2.0
JavaScript 1.3: Deprecated. |
| ECMA Version: | ECMA-262 |
[edit] Syntax
setYear(yearValue)
[edit] Parameters
-
yearValue - An integer.
[edit] Description
setYear is no longer used and has been replaced by the setFullYear method.
If yearValue</code. is a number between 0 and 99 (inclusive), then the year for <code>dateObjectName is set to 1900 + yearValue. Otherwise, the year for dateObjectName is set to yearValue.
To take into account years before and after 2000, you should use setFullYear instead of setYear so that the year is specified in full.
[edit] Examples
[edit] Example: Using setYear
The first two lines set the year to 1996. The third sets the year to 2000.
theBigDay.setYear(96) theBigDay.setYear(1996) theBigDay.setYear(2000)