date.getYear() minus 1900

RESOLVED DUPLICATE of bug 22964

Status

()

Core
JavaScript Engine
--
major
RESOLVED DUPLICATE of bug 22964
16 years ago
14 years ago

People

(Reporter: Teebo Jamme, Assigned: rogerl (gone))

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
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.

Comment 1

16 years ago
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
Last Resolved: 16 years ago
Resolution: --- → DUPLICATE

Comment 3

16 years ago
Verified Duplicate -
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---

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