Event.timeStamp is a read-only number: milliseconds from the page’s (or worker’s) time origin until the event was created. It is a DOMHighResTimeStamp. (MDN: Baseline Widely available since July 2015; also in Web Workers.)
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.timeStamp. Start with this line.
JavaScript
event.timeStamp
Call
What it does
event.timeStamp
Primary signature.
Built into the browser. Read event.timeStamp on an Event instance — no import required.
Library declarations
JavaScript
event.timeStamp
Parameters
Parameter
Description
Previous stamp
Optional. Needed only for deltas
Return Value
Return Value
Description
*
The current value of event.timeStamp.
JavaScript Examples
Example 1 — Read timeStamp on Click
Log the milliseconds since the time origin when the button is clicked.
Listen on body. Keypress events bubble to it when focus is in the document.
Press a key. The handler runs with the key event.
Write the stamp. Update a text node / element with event.timeStamp.
Same idea as MDN. Useful for seeing live values while typing.
Example 3 — Milliseconds Between Clicks
Subtract the previous stamp from the current one to get a delta.
JavaScript
let last = null;
button.addEventListener("click", (event) => {
if (last !== null) {
console.log(event.timeStamp - last); // ms since last click
}
last = event.timeStamp;
});
Keep last. Store the previous event’s stamp (or null at first).
First click. No delta yet — only save the stamp.
Later clicks.current - last is the gap in milliseconds.
Same origin. Both values share the page time origin, so subtraction is meaningful.
Compatibility
Browser Support
Event.timeStamp is marked Baseline Widely available on MDN (since July 2015). It is also available in Web Workers. Precision may be reduced for privacy.
✓ Baseline · Widely available
Event.timeStamp
Read-only DOMHighResTimeStamp: milliseconds from the time origin until the event was created.
UniversalWidely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
Event.timeStampExcellent
Bottom line: Safe to use for relative event timing. Expect rounded values; prefer deltas over absolute stamps for UX logic.
Frequently Asked Questions
It is a read-only number on an Event: the time in milliseconds when the event was created, measured from the relevant global object’s time origin (a DOMHighResTimeStamp).
No. MDN marks Event.timeStamp as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
In a window, it is typically when navigation to the document started. In a worker, it is when the worker was created. event.timeStamp counts milliseconds from that origin.
Browsers often reduce precision to help prevent fingerprinting and timing attacks. Fractional milliseconds do not always mean full precision. Values are still useful for relative deltas.
Store the first event.timeStamp, then subtract it from a later event.timeStamp. The delta is in milliseconds (subject to reduced precision).
No. Date.now() is wall-clock time since the Unix epoch. event.timeStamp is relative to the document/worker time origin—better for comparing event timing within a page.