Name
getYear() — NN 2 IE J1 ECMA 1
Synopsis
Returns a number corresponding to the year but exhibits irregular
behavior. In theory, the method should return the number of years the
date object represents since 1900. This would produce a one- or
two-digit value for all years between 1900 and 1999. However when you
reach 2000, the pattern fails. Instead of producing values starting
with 100, the getYear() method starting with
Navigator 3 and IE 4, returns the same four-digit value as
getFullYear(). For this reason, it is best to use
getFullYear() whenever possible (but observe the
browser compatibility for that method).
Returned Value
Integer between and 99 for the years 1900 to 1999; four-digit integer starting with 2000.
Parameters
None.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access