Closed Bug 153229 Opened 22 years ago Closed 20 years ago

date.getYear() minus 1900

Categories

(Core :: JavaScript Engine, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: teebo, Assigned: rogerl)

Details

Maybe Mozilla is the one that's right, but:

my2002date = new date(... a 2002 date...)

MS IE my2002date.getYear() returns 2002
Moz 1.0 my2002date.getYear() returns 102 (!)

A work around was easy, but still there'a
discrepancy somewhere.

Maybe this is the same as bug 2183 - sorry if it's the case.
http://developer.netscape.com/docs/manuals/js/core/jsref15/date.html#1193607
explains this. 
http://developer.netscape.com/docs/manuals/js/core/jsref15/date.html#1194138
explains how Date.getYear is, by design, year - 1900.  Also note that the second
link mentions that getYear is deprecated as of JS1.3.
This is the correct behavior.  You want getFullYear().

See bug 45764, comment #4 for the full skinny on getYear()

*** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Verified Duplicate -
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.