Date.getFullYear() Get the year
Last updated: 2026-09-09
Date.getFullYear() Get the year
getFullYear returns the 4-digit year of a Date object.
| Category | Dates |
|---|---|
| ES version | ES1 |
📝 Syntax
const year = date.getFullYear();
Returns:The 4-digit year (e.g. 2026).
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
2026
2024
💡 Tip Combine getFullYear/getMonth/getDate — getMonth is 0-based!
⚠️ Warning Never use getYear() (deprecated) — always getFullYear().
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| Date.getFullYear() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QWhy does getMonth() return 0?
AHistorical design — 0-based months. Use getMonth() + 1.
QgetYear() vs getFullYear()?
AgetYear() is deprecated and inconsistent. Always use getFullYear().
QHow to get the current year?
Anew Date().getFullYear().