Closed
Bug 276567
Opened 21 years ago
Closed 21 years ago
The Date Object has an error.
Categories
(Firefox :: General, defect)
Tracking
()
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());
Comment 1•21 years ago
|
||
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.
Comment 2•21 years ago
|
||
*** This bug has been marked as a duplicate of 58241 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Updated•21 years ago
|
Status: RESOLVED → VERIFIED
Updated•21 years ago
|
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 3•21 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•