Closed Bug 261399 Opened 22 years ago Closed 21 years ago

java script adding 1 to getYear() makes 105 instead of 2005

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 22964

People

(Reporter: renejn, Unassigned)

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10 a .asp page i'v made. Has a java script function that looks like this : d = new Date(); jaar = d.getYear(); jaar = jaar+1; jaar = jaar.toString(); jaar1 = jaar.substring(0,4); alert(jaar1); the alert shows 105 instead of 2005. IE6 does this right. Reproducible: Always Steps to Reproduce: 1. 2. 3.
Use getFullYear to get your desired result. IE is doing it wrong. *** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Use getFullYear instead: <http://www.google.com/search?as_q=javascript+getyear&num=30> For compatibility with older browsers that don't support getFullYear see: <http://www.quirksmode.org/js/introdate.html#sol> <http://sys-con.com/story/?storyid=34119> <http://developer.netscape.com/viewsource/goodman_2k.html> and so on and so on. Google is a vastly underutilised resource I fear. JdG
Product: Browser → Seamonkey
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago → 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.