getFullYear() returns the four-digit calendar year (e.g. 2026) from a Date object in local time. This guide covers syntax, five examples, UTC comparisons, validation, and common real-world patterns like copyright footers.
01
Syntax
date.getFullYear()
02
Format
4-digit year
03
Local time
Not UTC
04
vs getYear
Deprecated
05
Footer
Copyright year
06
Validate
Invalid → NaN
Fundamentals
Introduction
Copyright notices, age displays, fiscal-year filters, and “posted in 2026” labels all need the year component from a Date. The getFullYear() method returns that value as a plain integer using the user’s local timezone.
Pair it with getMonth() and getDate() to build custom formats, or use getUTCFullYear() when your app standardizes on UTC.
Concept
Understanding the getFullYear() Method
Date.prototype.getFullYear() is a zero-argument instance method. It never mutates the original Date—it only reads the year component according to local time rules.
Unlike the deprecated getYear() (which returned year - 1900), getFullYear() always gives you the complete four-digit year, which is what humans expect in UI copy and logs.
💡
Beginner Tip
Need the year in a string? String(date.getFullYear()) works, but for full dates prefer toLocaleDateString() or Intl.DateTimeFormat.
Foundation
📝 Syntax
JavaScript
dateObj.getFullYear()
Parameters
None.
Return value
Integer four-digit year (e.g. 2026) for a valid date in local time.
NaN if dateObj is an invalid Date.
Cheat Sheet
⚡ Quick Reference
Goal
Code
Current year
new Date().getFullYear()
Year from fixed date
new Date(2026, 6, 4).getFullYear() → 2026
UTC year
date.getUTCFullYear()
Copyright footer
el.textContent = new Date().getFullYear()
Set year
date.setFullYear(2027)
Valid date check
!Number.isNaN(date.getTime())
Compare
📋 getFullYear() vs Similar Methods
Pick the getter that matches your timezone strategy and the format you need to display.
getFullYear()
2026
Local 4-digit year
getUTCFullYear()
UTC year
Timezone-safe read
getYear() ⚠
126
Deprecated; avoid
getMonth()
0–11
Zero-based month
Hands-On
Examples Gallery
Open DevTools Console (F12) or use Try-it links. Fixed dates use new Date(year, monthIndex, day) to avoid string parsing surprises.
📚 Getting Started
Read the year from the current date.
Example 1 — Get the Current Year
Call getFullYear() on a new Date() to read today’s calendar year.
Year subtraction alone is not enough—someone born May 15 is still one year younger on January 1. Combining getFullYear(), getMonth(), and getDate() fixes that edge case.
Applications
🚀 Common Use Cases
Copyright footers — auto-update the year in site footers.
Age gates — compare birth year against a minimum age rule.
Year filters — “show posts from 2025” in dashboards.
Invoice headers — fiscal year labels on PDFs.
Form defaults — pre-select year in date pickers.
Analytics buckets — group events by calendar year.
🧠 How getFullYear() Resolves the Year
1
Internal instant
The Date stores milliseconds since Unix epoch (UTC).
Storage
2
Local conversion
Engine applies the runtime timezone offset.
TZ
3
Extract year
Four-digit calendar year is returned as an integer.
getFullYear
4
📅
Use in UI
Display, filter, compare, or pass to setFullYear.
Important
📝 Notes
getFullYear() is local; use getUTCFullYear() when you standardize on UTC.
Never use deprecated getYear()—it returns year - 1900.
Invalid dates propagate NaN—validate first.
Near midnight on Dec 31 / Jan 1, local year can differ from UTC year on the same instant.
Age from year subtraction alone is approximate; include month and day for accuracy.
Store the year in a variable if you use it multiple times in the same function for readability.
Compatibility
Browser & Runtime Support
Date.prototype.getFullYear() has been available since the first JavaScript Date implementation (ES1). It works in every browser and Node.js.
✓ Baseline · ES1
Date.prototype.getFullYear()
Supported in Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions. No polyfill required.
99%Universal API
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Date.getFullYear()Excellent
Bottom line: Safe everywhere. Watch timezone boundaries when pairing with UTC getters or ISO strings parsed from servers.
Wrap Up
Conclusion
getFullYear() is the standard way to read the four-digit calendar year from a JavaScript Date in local time. Use it for footers, filters, and date math—and pair it with month/day getters when precision matters.
A four-digit integer year (e.g. 2026) according to the Date object's local timezone. It always returns the full year—not a two-digit value.
getFullYear() uses local timezone rules. getUTCFullYear() reads the UTC calendar year. Near midnight on New Year's Eve they can differ by one year.
No. getYear() is deprecated and returned year minus 1900 (e.g. 126 for 2026). Always use getFullYear() for the four-digit year.
NaN. Validate with !Number.isNaN(date.getTime()) before using the result in UI or calculations.
No. Unlike the old getYear() method, getFullYear() always returns the complete four-digit year, including years before 1000 and after 9999.
document.getElementById('year').textContent = new Date().getFullYear(); This updates automatically each January without manual edits.
Did you know?
The old getYear() method returned 2026 - 1900 = 126 for the year 2026. That two-digit-style offset caused Y2K-era bugs—which is why getFullYear() replaced it as the standard.