CKTIS / JavaScript
Date.now: current timestamp
Date.now returns current wall-clock time as an integer number of milliseconds since the Unix epoch in UTC.
Version: ECMAScript 5 (2009) onward; example target: Node.js 24.22.2
Syntax
Date.now()Date.now() returns the current time value as a Number: milliseconds since 1970-01-01T00:00:00Z. ECMAScript treats each day as exactly 86,400,000 ms and does not represent leap seconds. The result can be stored as a timestamp or passed to new Date(ms).
Wall-clock time is not monotonic: a system-clock correction can make a later value smaller, and an environment may reduce precision for privacy. Use performance.now() for measuring durations in a browser. Also do not assume that two consecutive calls return different numbers.
The method takes no arguments; extra arguments are ignored. Date.now is not a constructor, so new Date.now() throws TypeError. It has been standard since ECMAScript 5 (2009).
Examples
const startedAt = Date.now();
const record = {createdAt: Date.now()};
const finishedAt = Date.now();
console.log(Number.isInteger(record.createdAt), record.createdAt >= startedAt && record.createdAt <= finishedAt);
console.log(new Date(record.createdAt).getTime() === record.createdAt);
console.log(Date.now.length);Result
true true true 0