Possible Duplicate:
Why does Javascript getYear() return 108?
Javascript date.getYear() returns 111 in 2011?
var testDate=new Date("Wed Dec 07 00:00:00 PST 2011")
testDate.getYear();
for the above statement, I am getting 111 while I expect 2011.
Why am getting 111 only?
getYear is documented to return the year minus 1900, so you are actually getting the expected value. It's also deprecated. Use getFullYear to receive 2011.
use getFullYear()
var testDate=new Date("Wed Dec 07 00:00:00 PST 2011")
testDate.getFullYear();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With