Closed Bug 276567 Opened 21 years ago Closed 21 years ago

The Date Object has an error.

Categories

(Firefox :: General, defect)

1.0 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: liubingqian, Assigned: bugzilla)

Details

Today is Dec 31 2004,this code's result is Dec 31 104 now = new Date(); document.write((now.getMonth()+1)+" "+now.getDate()+" "+now.getYear());
This is actually correct behavior. You may instead want .getFullYear(). From the ECMA-262 specification: --- Date.prototype.getYear() This function is specified here for backwards compatibility only. The function getFullYear is much to be preferred for nearly all purposes, because it avoids the “year 2000 problem.” 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return YearFromTime(LocalTime(t)) - 1900. --- In this case, YearFromTime(LocalTime(t)) - 1900 = 104.
*** This bug has been marked as a duplicate of 58241 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.