getYear (JavaScript)
Gets the year in local time in an abbreviated format.
Defined in
Date (Standard - JavaScript)Syntax
getYear() : int
Return value | Description |
---|---|
int |
The year using 1900 as an implied base. For
example, 99 means 1999 and 107 means 2007 . |
Usage
Preferred is getFullYear (JavaScript).Examples
This computed label converts the abbreviated year to a full year.var date = new Date();
(date.getYear() + 1900).toString() // gets full year