JavaScript Date setUTCFullYear() Method

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
UTC year setter

What You’ll Learn

setUTCFullYear() writes the four-digit year on a Date in UTC, with optional month and day overload. This guide covers syntax, UTC year increments, leap-day normalization, and comparisons with local setFullYear().

01

Syntax

setUTCFullYear(y)

02

Overload

y, m, d

03

UTC

Not local

04

+ 1 year

getUTCFullYear

05

Leap day

Normalizes

06

Returns

Epoch ms

Introduction

Global contracts, ISO reporting, and server-side schedules often anchor dates in UTC. After reading the UTC year with getUTCFullYear(), setUTCFullYear() writes it back without using local timezone rules.

Like setFullYear(), it mutates the Date and returns epoch milliseconds. Use UTC getters and setters together—do not mix local setFullYear with UTC getUTCFullYear in one step.

Understanding the setUTCFullYear() Method

Date.prototype.setUTCFullYear(year [, monthIndex [, day]]) accepts a four-digit UTC year and optional zero-based month and day. When you pass only the year, UTC month and day stay the same unless normalization is required (for example UTC Feb 29 in a non-leap year).

The method returns epoch milliseconds, not the Date object. Call each setter on the same Date variable when you need multiple changes—do not chain on the numeric return value.

💡
Beginner Tip

To add one UTC year: date.setUTCFullYear(date.getUTCFullYear() + 1). For a full UTC date: date.setUTCFullYear(2027, 6, 15) sets 15 July 2027 UTC.

📝 Syntax

JavaScript
dateObj.setUTCFullYear(year)
dateObj.setUTCFullYear(year, monthIndex)
dateObj.setUTCFullYear(year, monthIndex, day)

Parameters

  • year — Four-digit integer (e.g. 2027).
  • monthIndex (optional) — Zero-based UTC month 0–11 (January = 0).
  • day (optional) — UTC day-of-month 1–31; requires monthIndex when provided.

Return value

  • Updated epoch milliseconds after the change.
  • NaN if the Date was invalid before the call.

⚡ Quick Reference

GoalCode
Set UTC year onlydate.setUTCFullYear(2027)
Set UTC y + m + ddate.setUTCFullYear(2027, 6, 15)
Add one UTC yeardate.setUTCFullYear(date.getUTCFullYear() + 1)
Read UTC year after setdate.getUTCFullYear()
Local year setterdate.setFullYear(2027)
Clone before mutateconst copy = new Date(date)

📋 setUTCFullYear() vs Similar Methods

Pick the setter that matches your timezone rules.

setUTCFullYear()
UTC yr

UTC year

getUTCFullYear()
read

Getter pair

setFullYear()
local yr

Local setter

setUTCDate()
UTC day

Day setter

Examples Gallery

Open DevTools Console (F12) or use Try-it links. Examples use Date.UTC() for predictable UTC calendar values.

📚 Getting Started

Change only the UTC year while keeping month and day.

Example 1 — Set the UTC Year to 2027

Start on 26 February 2026 UTC and move to 26 February 2027 UTC.

JavaScript
const date = new Date(Date.UTC(2026, 1, 26));
date.setUTCFullYear(2027);

console.log(date.getUTCFullYear());  // 2027
console.log(date.getUTCMonth());     // 1 (February)
console.log(date.getUTCDate());      // 26
Try It Yourself

How It Works

Only the UTC year changes when you pass one argument. Verify with toISOString() for ISO-aligned checks.

📈 Practical Patterns

Full UTC date overload, increments, return values, and leap-day edge cases.

Example 2 — Set UTC Year, Month, and Day Together

Use the three-argument overload for 15 July 2027 UTC in one call.

JavaScript
const date = new Date(Date.UTC(2026, 1, 26));
date.setUTCFullYear(2027, 6, 15); // July 15, 2027 UTC

console.log(date.getUTCFullYear());  // 2027
console.log(date.getUTCMonth());     // 6 (July)
console.log(date.getUTCDate());      // 15
Try It Yourself

How It Works

Month index 6 is July. This overload matches forms that collect UTC year, month, and day separately.

Example 3 — Add One UTC Year

Annual UTC renewals often use this read-then-write pattern.

JavaScript
const renewal = new Date(Date.UTC(2026, 2, 15)); // March 15, 2026 UTC
renewal.setUTCFullYear(renewal.getUTCFullYear() + 1);

console.log(renewal.getUTCFullYear());  // 2027
console.log(renewal.getUTCMonth());     // 2 (March)
console.log(renewal.getUTCDate());      // 15
Try It Yourself

How It Works

Use getUTCFullYear(), not getFullYear(), when your business rules follow UTC.

Example 4 — Use the Return Value (Epoch Milliseconds)

setUTCFullYear returns the updated timestamp—not the Date for chaining.

JavaScript
const date = new Date(Date.UTC(2026, 1, 26));
const ms = date.setUTCFullYear(2027);

console.log("Type:", typeof ms);                    // "number"
console.log("Matches getTime():", ms === date.getTime()); // true

// Correct multi-step updates on the same Date:
date.setUTCFullYear(2028);
date.setUTCMonth(11);
date.setUTCDate(31);
Try It Yourself

How It Works

Do not write date.setUTCFullYear(2027).setUTCMonth(11)—the first call returns a number. Call each setter on date separately.

Example 5 — UTC Leap-Day Normalization (Feb 29 → Non-Leap Year)

Moving UTC Feb 29, 2024 to 2025 rolls into March because 2025 is not a leap year.

JavaScript
const date = new Date(Date.UTC(2024, 1, 29)); // Feb 29, 2024 UTC
date.setUTCFullYear(2025);

console.log(date.getUTCFullYear());  // 2025
console.log(date.getUTCMonth());     // 2 (March)
console.log(date.getUTCDate());      // 1
Try It Yourself

How It Works

There is no Feb 29 in 2025 UTC, so the engine normalizes to March 1. Plan anniversary logic for leap-day UTC dates carefully.

🚀 Common Use Cases

  • ISO contract renewals — bump UTC expiry by one year.
  • Global reporting — align fiscal UTC anchors across regions.
  • Server-side forms — apply UTC year/month/day from API payloads.
  • Historical UTC dates — set years on parsed ISO timestamps.
  • Leap-day policies — handle Feb 29 UTC birthdays and anniversaries.
  • Clone + mutate — copy before changing UTC year for comparisons.

🧠 How setUTCFullYear() Updates the UTC Calendar

1

Read UTC fields

Engine loads UTC year, month index, and day.

UTC
2

Apply new year

Year and optional month/day replace old UTC values.

setUTCFullYear
3

Normalize overflow

Invalid UTC dates (e.g. Feb 29 non-leap) roll forward.

Normalize
4

Mutate & return ms

Date updates in place; epoch milliseconds are returned.

📝 Notes

  • setUTCFullYear() changes the UTC calendar year—not the local one from getFullYear().
  • Month index is zero-based: January = 0, December = 11.
  • Omitting month/day keeps current UTC month and day unless normalization applies.
  • Mutates the original Date—clone with new Date(date) when needed.
  • Returns epoch ms, not the Date—no fluent chaining on the return value.
  • Verify with getUTCFullYear(), getUTCMonth(), and toISOString().

Browser & Runtime Support

Date.prototype.setUTCFullYear() has been available since ES1. It works in every browser and Node.js.

Baseline · ES1

Date.prototype.setUTCFullYear()

Supported in Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions. No polyfill required.

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.setUTCFullYear() Excellent

Bottom line: Safe everywhere. Pair with getUTCFullYear() and keep UTC math in UTC.

Conclusion

setUTCFullYear() writes the UTC four-digit year (and optionally month and day) on a JavaScript Date. Use it for ISO-aligned scheduling; use setFullYear() for local user calendars.

Next, learn setUTCHours() to change the UTC hour, or review getUTCFullYear() for reading the UTC year.

💡 Best Practices

✅ Do

  • Use getUTCFullYear() + 1 for UTC year increments
  • Build test dates with Date.UTC()
  • Use the three-arg overload for full UTC calendar snaps
  • Clone before mutating shared Date instances
  • Check leap-day UTC dates when bumping years

❌ Don’t

  • Mix setUTCFullYear with getFullYear()
  • Chain setters on the numeric return value
  • Assume human month numbers 1–12 without subtracting 1
  • Use local setters for server UTC cron rules
  • Forget Feb 29 normalization in non-leap target years

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.setUTCFullYear()

Your foundation for UTC year writes in JavaScript.

5
Core concepts
🌐 02

UTC

Not local.

Timezone
📈 03

3 args

y, m, d.

Overload
04

+ year

getUTCFullYear.

Pattern
05

Feb 29

Normalizes.

Leap

❓ Frequently Asked Questions

It sets the four-digit year of a Date object in UTC. Optional month (0–11) and day arguments can update the full UTC calendar date. The Date mutates in place and returns epoch milliseconds.
setFullYear() changes the local calendar year. setUTCFullYear() changes the UTC calendar year. They can differ near timezone midnight boundaries.
getUTCFullYear() reads the current UTC year. setUTCFullYear(year) writes a new UTC year. They are the read/write pair for four-digit UTC years.
Yes. setUTCFullYear(year, monthIndex, day) updates all three UTC calendar fields at once—month is zero-based like getUTCMonth().
JavaScript normalizes overflow. Feb 29, 2024 UTC becomes March 1, 2025 UTC when you setUTCFullYear(2025) without changing month/day.
No. It returns a number (epoch milliseconds). Call each setter on the same Date variable—do not chain on the return value.
Did you know?

When you pass only setUTCFullYear(2027), UTC month and day stay the same—unlike some tutorials that imply month resets. But UTC Feb 29 plus a non-leap year still normalizes to March 1, just like local setFullYear().

Continue to setUTCHours()

Learn how to set the UTC hour (0–23) on a Date object.

setUTCHours() 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.

6 people found this page helpful