constructor

Date.now

Returns the current time as an integer number of milliseconds since the Unix epoch without allocating a Date object. Use it for timestamps, expiry checks, and simple timing.

Date.now()

Parameters

Parameter Purpose
() no arguments; returns Number (integer ms)
resolution wall-clock precision (ms); for high-res timing use performance.now()

Examples

console.log(Date.now()); // e.g. 1784332800000

current epoch milliseconds

const t = Date.now(); doWork(); console.log(Date.now() - t, 'ms');

coarse elapsed timing

console.log(new Date(Date.now()).toISOString());

convert to Date/ISO string

Gotcha

Date.now() is wall-clock and can jump backwards when the system clock is adjusted; use performance.now() for monotonic sub-millisecond timing.

Related

← All JS Date methods · Math methods · Cron syntax