JavaScript Date setUTCFullYear() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.setUTCFullYear() changes the year for this date according to universal time (UTC), and optionally the month and day (MDN). It mutates the Date in place and returns the new timestamp.

Remember
date.setUTCFullYear(year)
date.setUTCFullYear(year, month)
date.setUTCFullYear(year, month, day)

year:  four-digit UTC year (e.g. 1997)
month: 0 … 11 (optional; Jan = 0)
day:   1 … 31 (optional; requires month)
→ returns new timestamp (ms)
→ mutates date

setUTCFullYear(1975)           // keep month/day
setUTCFullYear(2030, 6, 20)    // Jul 20, 2030 UTC
setUTCFullYear(2025) on Feb 29 → Mar 1, 2025 UTC

Syntax

Call date.setUTCFullYear. Start with this line.

JavaScript
date.setUTCFullYear(y[, m[, day]])
CallWhat it does
date.setUTCFullYear(y[, m[, day]])Primary signature.
date.setUTCFullYear(...)Call with the arguments your case needs.

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

Library declarations
JavaScript
date.setUTCFullYear(y[, m[, day]])

Parameters

ParameterDescription
yearValueRequired. UTC four-digit year
monthValueOptional. UTC month 0–11; keep current if omitted
dateValueOptional. UTC day 1–31; requires monthValue

Return Value

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

JavaScript Examples

Example 1 — Set the UTC Year Only

MDN: the offset string is already Jan 1 UTC; change only the year.

JavaScript
const event = new Date("December 31, 1975 23:15:30 GMT-3:00");

console.log(event.getUTCFullYear()); // 1976

event.setUTCFullYear(1975);

console.log(event.getUTCFullYear()); // 1975
console.log(event.toISOString());    // "1975-01-01T02:15:30.000Z"
Try It Yourself

How It Works

  1. Parse with offset. Local Dec 31 + GMT-3 is already Jan 1, 1976 UTC.
  2. Read. getUTCFullYear() reports 1976.
  3. Write year only. Month and day stay January 1.
  4. Result. Same clock time on Jan 1, 1975 UTC.

Example 2 — Set Year, Month, and Day Together

Pass three arguments to write a full UTC calendar date.

JavaScript
const d = new Date(Date.UTC(2026, 0, 15));

d.setUTCFullYear(2030, 6, 20); // July = 6

console.log(d.getUTCFullYear()); // 2030
console.log(d.getUTCMonth());    // 6
console.log(d.getUTCDate());     // 20
console.log(d.toISOString());    // "2030-07-20T00:00:00.000Z"
Try It Yourself

How It Works

  1. Start from a UTC date. Any base instant works.
  2. Pass three numbers. Year, zero-based month, and day.
  3. July is 6. Same zero-based rule as getUTCMonth().
  4. One call. Avoids separate setUTCMonth() / setUTCDate() steps.

Example 3 — Leap Day Normalizes on Non-Leap Years

Feb 29 in a leap year becomes Mar 1 after changing to a non-leap year.

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

d.setUTCFullYear(2025);

console.log(d.toISOString()); // "2025-03-01T00:00:00.000Z"
console.log(d.getUTCMonth()); // 2 (March)
console.log(d.getUTCDate());  // 1
Try It Yourself

How It Works

  1. Start on Feb 29, 2024. 2024 is a leap year.
  2. Change year to 2025. 2025 is not a leap year.
  3. Engine normalizes. Invalid Feb 29 rolls to March 1.
  4. Watch for this when shifting birthdays or schedules across years.

Browser & Runtime Support

Date.prototype.setUTCFullYear() is part of the language from early ECMAScript and is Baseline Widely available (MDN).

✓ Baseline · Widely available

Date.prototype.setUTCFullYear()

Supported in every modern browser and Node.js. No polyfill needed for ordinary web apps.

99% Modern browser support
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. Focus on mutation, zero-based months, leap-day normalization, and UTC vs local choice.

Frequently Asked Questions

It sets the four-digit year of a Date according to 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.
Yes. setUTCFullYear(year, month, day) updates all three. If you pass day, you must also pass month (MDN).
JavaScript normalizes the date. Feb 29, 2024 UTC + setUTCFullYear(2025) becomes March 1, 2025 UTC.
No. It returns a number (epoch milliseconds). Call setters on the Date variable — do not chain on the return value.
Out-of-range months overflow into other years. For example, month 15 becomes year+1 and month 3 (MDN).

Next: setUTCHours()

Learn how to set the UTC hour (and optional minutes/seconds/ms) on a Date.

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.

11 people found this page helpful