Date.now() is a static method that returns the number of milliseconds since January 1, 1970 UTC (the Unix epoch) at the moment you call it. You do not need new Date().
Remember
Date.now()
→ number (ms since 1970-01-01 UTC)
→ no Date instance required
→ call it again → a new (usually larger) value
Date.now() → current epoch ms
new Date().getTime() → same idea (needs an instance)
performance.now() → elapsed ms since page load (browser)
Syntax
Call Date.now. Start with this line.
JavaScript
Date.now()
Call
What it does
Date.now()
Primary signature.
Date.now(...)
Call with the arguments your case needs.
Built into JavaScript. Call Date.now(...) on the Date constructor — no import required.
Library declarations
JavaScript
Date.now()
Parameters
This method has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
The value returned by Date.now().
JavaScript Examples
Example 1 — Read the Current Timestamp
Call Date.now() and check that you get a large integer.
Both express epoch milliseconds; only one needs a Date object.
JavaScript
const a = Date.now();
const b = new Date().getTime();
console.log(typeof a); // "number"
console.log(typeof b); // "number"
console.log(Math.abs(a - b) < 5); // true — same moment window
Subtract.Date.now() - start is elapsed milliseconds.
Wall clock. For micro-benchmarks in browsers, prefer performance.now().
Compatibility
Browser & Runtime Support
Date.now() has been in the language since ES5 and is Baseline Widely available (MDN).
✓ Baseline · Widely available
Date.now()
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.now()Excellent
Bottom line: Safe everywhere. Focus on units (ms vs seconds) and when to prefer performance.now() rather than feature detection.
Frequently Asked Questions
A number: milliseconds since January 1, 1970 00:00:00 UTC (the Unix epoch) at the moment you call it. It is not a clock component like 0–59.
No. Date.now() is a static method on the Date constructor. Call Date.now() directly.
Date.now() is static and returns the current epoch milliseconds. getTime() reads an existing Date. For “right now”, new Date().getTime() and Date.now() are equivalent.
Milliseconds. Use Math.floor(Date.now() / 1000) when you need whole Unix seconds.
Date.now() is wall-clock epoch time (can jump if the system clock changes). performance.now() is high-resolution elapsed time since page load and is better for micro-benchmarks in the browser.
Yes. To limit fingerprinting, some browsers round timestamps. The value is still an integer number of milliseconds (MDN).