Date.prototype.getMilliseconds() returns the millisecond fraction of the current second as an integer 0–999 in local time. It is read-only and does not change the Date.
Remember
date.getMilliseconds()
0 = start of the second
123 = 123 ms into the second
999 = last millisecond of the second
→ integer 0 … 999
→ NaN if the Date is invalid
getMilliseconds() → 0–999 fraction
getTime() → ms since 1970-01-01 UTC
Syntax
Call date.getMilliseconds. Start with this line.
JavaScript
date.getMilliseconds()
Call
What it does
date.getMilliseconds()
Primary signature.
date.getMilliseconds(...)
Call with the arguments your case needs.
Built into JavaScript. Call getMilliseconds(...) on a Date instance — no import required.
Library declarations
JavaScript
date.getMilliseconds()
Parameters
Parameter
Description
Padding
Optional. Use padStart(3, "0") for .123-style display
Return Value
Return Value
Description
*
The value returned by date.getMilliseconds().
JavaScript Examples
Example 1 — Read the Millisecond Fraction
Call getMilliseconds() when ms are set — and when they default to 0.
JavaScript
const withMs = new Date(2026, 0, 1, 12, 0, 0, 456);
const xmas = new Date(1995, 11, 25, 23, 15, 30); // ms omitted
console.log(withMs.getMilliseconds()); // 456
console.log(xmas.getMilliseconds()); // 0
Epoch remainder.getTime() % 1000 often matches that fraction.
Full timeline.getTime() itself is a huge number (ms since 1970).
Measuring gaps. Subtract getTime() values — never use the 0–999 field alone.
Compatibility
Browser & Runtime Support
Date.prototype.getMilliseconds() is part of the language from early ECMAScript and is Baseline Widely available (MDN).
✓ Baseline · Widely available
Date.prototype.getMilliseconds()
Supported in every modern browser and Node.js. No polyfill needed for ordinary web apps.
99%Modern browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Date.getMilliseconds()Excellent
Bottom line: Safe everywhere. Focus on choosing getMilliseconds vs getTime correctly rather than feature detection.
Frequently Asked Questions
An integer from 0 to 999 for the milliseconds within the current second in local time. It is not the total milliseconds since 1970 — that is getTime().
getMilliseconds() returns the 0–999 sub-second fraction. getTime() returns the full epoch milliseconds since January 1, 1970 UTC.
getMilliseconds() uses local time. getUTCMilliseconds() uses UTC. For most instants they match; prefer the UTC getter when your code is timezone-agnostic.
NaN. Validate with Number.isNaN(date.getTime()) before using the result.
No. Subtract getTime() values, or use Date.now() / performance.now(). getMilliseconds() only reads the fraction inside one second.
No. The range is 0–999. Overflow carries into the seconds field automatically.