Closed
Bug 233092
Opened 21 years ago
Closed 21 years ago
Year of date incorrect : 104 instead of 2004
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: h.canevet, Unassigned)
References
()
Details
User-Agent: Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.4) Gecko/20030624 The date is displayed by this script : Nous sommes le : <script> d = new Date(); min=d.getMinutes(); if (min<10) { dizmin="0"; } else { dizmin=""; } document.write(d.getDate(),"/",d.getMonth()+1,"/",d.getYear() ," il est : ",d.getHours(),":",dizmin,min); </SCRIPT><br> Mozilla displays "Nous sommes le : 4/2/104 il est : 23:01" whereas Ms-IE displays "Nous sommes le : 4/2/2004 il est : 23:01" This latter format is the good one, it seems. Reproducible: Always Steps to Reproduce: 1. Just load the page Actual Results: The year is displayed with year 104 Expected Results: The year should have been displayed with year 2004 as with Ms-Internet Explorer
Comment 1•21 years ago
|
||
No, you have to use getFullYear() to retrieve the correct date. Netscape could never fix getYear() for reasons of backwards compatibility. See bug 22964 comment 2. *** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Comment 2•21 years ago
|
||
Forget backwards compat, actually. The ECMAScript spec explicitly says that getYear returns year-1900.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•