Availability: |
| |||||||||
Property/method value type: | Time value | |||||||||
JavaScript syntax: | - | myDate.setYear(aYearNumber) | ||||||||
Argument list: | aYearNumber | If the year number is less than 100, then 1900 is added to it. |
The result returned by this method is the new time value of the containing object having been adjusted by the values passed in as arguments.
The computation is carried out in local time coordinates.
This method has difficulties with properly resolving the century, which is why it is deprecated and should be replaced by Date.setFullYear() in your scripts.
As of ECMA edition 3 it is no longer included in the standard, although implementations may still provide it for backwards compatibility.
Although it is described in the ECMA standard, it is noted that this function is not formally part of the standard and an ECMA compliant implementation need not provide it. Instead, the Date.setFullYear() function should be used.
Nevertheless, some implementations may support this function although it is strongly recommended that you avoid its use.
Prev | Home | Next |
Date.setUTCSeconds() | Up | Date.toDateString() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |