JavaScript Date getUTCMilliseconds() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.getUTCMilliseconds() returns the milliseconds for this date as an integer 0–999 according to universal time (UTC) (MDN). It is read-only and does not change the Date.

Remember
date.getUTCMilliseconds()

→ integer 0 … 999 (UTC)
→ NaN if the Date is invalid

Example (MDN):
  new Date("2018-01-02T03:04:05.678Z").getUTCMilliseconds() → 678

getUTCMilliseconds() → UTC fraction
getMilliseconds()    → local fraction
getTime()            → full epoch milliseconds

Syntax

Call date.getUTCMilliseconds. Start with this line.

JavaScript
date.getUTCMilliseconds()
CallWhat it does
date.getUTCMilliseconds()Primary signature.
date.getUTCMilliseconds(...)Call with the arguments your case needs.

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

Library declarations
JavaScript
date.getUTCMilliseconds()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

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

JavaScript Examples

Example 1 — Read the UTC Milliseconds

Call getUTCMilliseconds() on fixed UTC instants (MDN-style).

JavaScript
const exampleDate = new Date("2018-01-02T03:04:05.678Z");
const zero = new Date(Date.UTC(2026, 0, 1, 12, 0, 0, 0));

console.log(exampleDate.getUTCMilliseconds()); // 678
console.log(zero.getUTCMilliseconds());        // 0
Try It Yourself

How It Works

  1. ISO with Z. The .678 part is the UTC millisecond field.
  2. Read. getUTCMilliseconds() returns 678.
  3. Date.UTC. The last argument sets UTC ms — here 0.
  4. No mutation. The Date values are unchanged.

Example 2 — getUTCMilliseconds() vs getMilliseconds()

UTC and local fractions often match; use the UTC getter for timezone-free code.

JavaScript
const d = new Date("2018-01-02T03:04:05.678Z");

console.log(d.getUTCMilliseconds()); // 678
console.log(d.getMilliseconds());    // usually 678 (local fraction)
Try It Yourself

How It Works

  1. Same instant. One Date, two getters.
  2. UTC. getUTCMilliseconds() always reports the UTC fraction — 678.
  3. Local. getMilliseconds() uses the host timezone; it usually matches, but can differ near second boundaries.
  4. Rule. Server / UTC pipelines → getUTCMilliseconds(); wall-clock local → getMilliseconds().

Example 3 — Pad to Three Digits (.sss)

Pad the UTC fraction for ISO-style display; contrast with getTime().

JavaScript
const d = new Date("2018-01-02T03:04:05.005Z");
const ms = d.getUTCMilliseconds();

console.log(String(ms).padStart(3, "0")); // "005"
console.log(d.getTime());                 // 1514862245005 (epoch ms)
Try It Yourself

How It Works

  1. Read. getUTCMilliseconds() returns 5.
  2. Pad. padStart(3, "0") turns it into "005".
  3. Contrast. getTime() is the full epoch number — not a 0–999 field.
  4. Tip. For ready-made UTC strings, prefer toISOString().

Browser & Runtime Support

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

✓ Baseline · Widely available

Date.prototype.getUTCMilliseconds()

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

Bottom line: Safe everywhere. Focus on UTC vs local choice and invalid-Date checks rather than feature detection.

Frequently Asked Questions

An integer from 0 to 999 representing the milliseconds within the current second according to UTC. Invalid Dates return NaN.
getUTCMilliseconds() returns only the 0–999 sub-second fraction in UTC. getTime() returns the full count of milliseconds since the Unix epoch.
getUTCMilliseconds() uses UTC. getMilliseconds() uses local time. For most instants they match; prefer the UTC getter when your code should ignore the host timezone.
NaN. Validate with Number.isNaN(date.getTime()) before using the result.
No. Subtract getTime() values, or use Date.now() / performance.now(). getUTCMilliseconds() only reads the fraction inside one UTC second.
No. The range is 0–999. Overflow carries into the UTC seconds field automatically.

Next: getUTCMinutes()

Learn how to read the UTC minutes field (0–59) from a Date.

getUTCMinutes() 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