Date.prototype.getFullYear()

Returns the four-digit year of a date in local time.

Since ES1 Spec ↗

Syntax

date.getFullYear()

Returns

number — The full year (e.g. 2026) in local time.

Examples

const d = new Date("2026-05-15T12:00:00");
console.log(d.getFullYear());
Output
2026
const d = new Date(0);
console.log(d.getUTCFullYear());
Output
1970

Notes

- Always use `getFullYear()`, never the legacy `getYear()`. - Use `getUTCFullYear()` for the year in UTC.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12
node 0.10

See also