JavaScript Date.UTC() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.UTC() is a static method that takes year, month, day (and optional time parts) as UTC values and returns the epoch milliseconds for that instant. It does not create a Date object by itself.

Remember
Date.UTC(year, monthIndex, day?, hours?, …)

→ number (ms since 1970-01-01 UTC)
→ parts treated as UTC (not local)
→ static — call Date.UTC(), not date.UTC()

Date.UTC(2018, 11, 1)           → Dec 1, 2018 UTC (ms)
new Date(Date.UTC(2018, 11, 1)) → Date for that instant
new Date(2018, 11, 1)           → local Dec 1 (different!)

Syntax

Call Date.UTC. Start with this line.

JavaScript
Date.UTC(y[, m[, d[, h[, min[, s[, ms]]]]]])
CallWhat it does
Date.UTC(y[, m[, d[, h[, min[, s[, ms]]]]]])Primary signature.
Date.UTC(...)Call with the arguments your case needs.

Built into JavaScript. Call Date.UTC(...) on the Date constructor — no import required.

Library declarations
JavaScript
Date.UTC(y[, m[, d[, h[, min[, s[, ms]]]]]])

Parameters

ParameterDescription
yearRequired. Full year, or 0–99 → 1900–1999
monthIndexOptional. UTC month (0–11); defaults to 0
dayOptional. Day of month; defaults to 1
hours ... msOptional. Time parts; each defaults to 0

Return Value

Return ValueDescription
*Epoch ms (number), or NaN if invalid

JavaScript Examples

Example 1 — Build a UTC Date from Parts

Pass UTC parts to Date.UTC(), then wrap the milliseconds in new Date.

JavaScript
const utcDate = new Date(Date.UTC(96, 1, 2, 3, 4, 5));

console.log(utcDate.toUTCString());
// "Fri, 02 Feb 1996 03:04:05 GMT"
Try It Yourself

How It Works

  1. Call Date.UTC. Year 96 becomes 1996; month 1 is February.
  2. Get a number. The static method returns epoch milliseconds for that UTC time.
  3. Wrap with new Date. The constructor turns those ms into a Date object.
  4. Print in UTC. toUTCString() shows the GMT string without local-zone noise.

Example 2 — UTC Parts vs Local Constructor

Same numbers, different meaning: UTC via Date.UTC, local via new Date(y, m, …).

JavaScript
const utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
const localDate = new Date(2018, 11, 1, 0, 0, 0);

console.log(utcDate.toISOString());
// "2018-12-01T00:00:00.000Z"

console.log(localDate.toISOString());
// depends on your timezone (often not midnight Z)
Try It Yourself

How It Works

  1. UTC path. Date.UTC(2018, 11, 1) means Dec 1, 2018 at midnight UTC.
  2. Local path. new Date(2018, 11, 1) means Dec 1 at midnight in the local zone.
  3. ISO shows the difference. The UTC date always ends with Z at 00:00:00.
  4. Why it matters. APIs and servers usually want UTC instants — use Date.UTC for that.

Example 3 — Two-Digit Year Maps to 1900s

Years 0–99 are treated as 1900–1999. Prefer four-digit years in new code.

JavaScript
const short = new Date(Date.UTC(95, 0, 1));
const full = new Date(Date.UTC(1995, 0, 1));

console.log(short.toISOString());
// "1995-01-01T00:00:00.000Z"

console.log(full.toISOString());
// "1995-01-01T00:00:00.000Z"
Try It Yourself

How It Works

  1. Short year. 95 is in the 0–99 range, so it becomes 1995.
  2. Full year. 1995 is used as-is.
  3. Same instant. Both calls produce January 1, 1995 UTC midnight.
  4. Tip. Write 1995 or 2026 in new code so the intent is obvious.

Browser & Runtime Support

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

✓ Baseline · ES1

Date.UTC()

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

Bottom line: Safe to use in any environment. Focus on return type (number), zero-based months, and the 0–99 year mapping. See also the MDN Date.UTC() reference.

Frequently Asked Questions

A number: milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC) for the UTC date-time built from the arguments. It does not return a Date object. Wrap with new Date(Date.UTC(...)) when you need a Date.
Date.UTC() treats every part as UTC and returns a number. new Date(year, month, …) treats parts as local time and returns a Date object. The same numbers often mean different instants.
Yes. January is 0, February is 1, …, December is 11. March is 2, not 3.
Values from 0 to 99 map to years 1900–1999. So Date.UTC(96, 1, 2) is February 2, 1996 UTC. Prefer full years like 1996 or 2026 to avoid ambiguity.
Modern engines treat omitted monthIndex as 0 (January) and day as 1. Date.UTC(2017) is midnight UTC on January 1, 2017.
Date.now() returns the current epoch milliseconds. Date.UTC() builds milliseconds for a specific UTC calendar date and time you pass in.

Next: valueOf()

Learn how a Date converts to its epoch milliseconds value.

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

14 people found this page helpful