JavaScript Date getFullYear() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.getFullYear() returns the full year for a date in local time (for example 1995 or 2026). It is read-only and does not change the Date.

Remember
date.getFullYear()

→ absolute year     (e.g. 1969, 1995, 2026)
→ NaN               (if the Date is invalid)

getFullYear()    → correct modern API
getYear()        → deprecated (year − 1900)
getUTCFullYear() → same idea, but UTC

Syntax

Call date.getFullYear. Start with this line.

JavaScript
date.getFullYear()
CallWhat it does
date.getFullYear()Primary signature.
date.getFullYear(...)Call with the arguments your case needs.

Built into JavaScript. Call getFullYear(...) on a Date instance — no import required.

Library declarations
JavaScript
date.getFullYear()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The value returned by date.getFullYear().

JavaScript Examples

Example 1 — Read the Full Year

Call getFullYear() on a fixed local date (month index is zero-based).

JavaScript
const moonLanding = new Date(1969, 6, 20); // Jul 20, 1969

console.log(moonLanding.getFullYear()); // 1969
Try It Yourself

How It Works

  1. Build a local date. new Date(1969, 6, 20) is July 20, 1969 (month index 6).
  2. Read the year. getFullYear() returns 1969 — the absolute year.
  3. Not two digits. You get the full value, not 69.
  4. No side effects. The Date is unchanged; getFullYear only reads.

Example 2 — getFullYear() vs Deprecated getYear()

See why the old API is misleading for modern years.

JavaScript
const d = new Date(2026, 2, 15);

console.log(d.getFullYear()); // 2026
console.log(d.getYear());     // 126  (deprecated)
Try It Yourself

How It Works

  1. Create March 15, 2026. Month index 2 is March.
  2. Use the modern getter. getFullYear() → 2026.
  3. See the old offset. getYear() → 2026 - 1900 = 126.
  4. Rule of thumb. Always prefer getFullYear(); treat getYear() as legacy only.

Browser & Runtime Support

Date.prototype.getFullYear() has been in JavaScript since ES1. It is Baseline and works in every modern browser and Node.js — no polyfill needed.

✓ Baseline · ES1

Date.prototype.getFullYear()

Supported everywhere Date exists: Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions.

99% Universal API
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.getFullYear() Excellent

Bottom line: Safe to use in any environment. Prefer it over deprecated getYear(). See also the MDN getFullYear() reference.

Frequently Asked Questions

An integer for the full year in local time (for example 1995 or 2026). For years 1000–9999 it is a four-digit number. Invalid dates return NaN.
getYear() is deprecated and returns year minus 1900 (for example 126 for 2026). getFullYear() returns the absolute year and is the correct modern API.
getFullYear() uses the local timezone. getUTCFullYear() uses UTC. Near New Year’s midnight they can differ by one year across timezones.
NaN. Validate with Number.isNaN(date.getTime()) before using the result in UI or math.
No. Unlike deprecated getYear(), getFullYear() always returns the absolute year number—not year − 1900.
Use new Date().getFullYear() and write it into the page. It updates automatically each January without hard-coding the year.

Next: getHours()

Learn how to read the hour of the day (0–23) from a Date in local time.

getHours() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful