getters

Date.prototype.getFullYear

Returns the 4-digit year of the date according to LOCAL time. Prefer this over the deprecated getYear(), which returns year-1900.

date.getFullYear()

Parameters

Parameter Purpose
() no arguments; returns Number
local time uses the host's local timezone; use getUTCFullYear for UTC

Examples

console.log(new Date('2026-07-19T12:00:00Z').getFullYear()); // 2026

local-year of a UTC instant

console.log(new Date(0).getUTCFullYear()); // 1970

UTC counterpart

const d = new Date(); console.log(d.getFullYear()); // current year

today's year

Gotcha

Returns the LOCAL-timezone year; near midnight on New Year's Eve/Day this can differ from the UTC year.

Related

← All JS Date methods · Math methods · Cron syntax