getYear() returns year minus 1900 . This has been deprecated for a while now, it's best to use getFullYear() . Show activity on this post. Its a Y2K thing, basically getYear method returns the year minus 1900.
getFullYear() The getFullYear() method returns the year of the specified date according to local time.
The getYear() method returns either a 2-digit or 4-digit year: For years between and including 1900 and 1999, the value returned by getYear() is the year minus 1900. For example, if the year is 1976, the value returned is 76.
Javascript date getFullYear() method returns the year of the specified date according to local time. The value returned by getFullYear() is an absolute number. For dates between the years 1000 and 9999, getFullYear() returns a four-digit number, for example, 2008.
It just makes no sense to me to get part of a year.
Back in the day, when memory was expensive and the Year 2000 was far in the future, it did make sense for people to represent 1975 as 75. In retrospect a short-sighted decision.
date.getFullYear() == date.getYear() + 1900
getYear()
returns year minus 1900
. This has been deprecated for a while now, it's best to use getFullYear()
.
Its a Y2K thing, basically getYear
method returns the year minus 1900.
so, I encourage to move over to getFullYear
& use that instead.
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