The result of this method is a 2 digit year number for the date contained in the receiving object.
The year number is a local time value.
However, in this case, the value 1900 is subtracted from the year on the assumption that a two digit year will result.
This can lead to year 2000 problems as the year value may be modulo 100 or it may carry over.
This is why the method is deprecated and should be replaced by Date.getFullYear() 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.getFullYear() 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.getVarDate() | Up | Date.length |
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. |