Why does this javascript return 108 instead of 2008? it gets the day and month correct but not the year?
myDate = new Date(); year = myDate.getYear();
year = 108?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s a Y2K thing, only the years since 1900 are counted.
There are potential compatibility issues now that
getYear()has been deprecated in favour ofgetFullYear()– from quirksmode:There are also implementation differences between Internet Explorer and Firefox, as IE’s implementation of
getYear()was changed to behave likegetFullYear()– from IBM: