JavaScript / Node.js
- Input
- Date.now()
- Expected output
- 1745352000000
Always in milliseconds: for seconds you need to divide by 1000 and truncate.
current unix timestamp now
The current timestamp changes every millisecond, so the right value here is not a fixed number to copy, it is the command or line of code that reads the system clock at the exact instant it runs. This page gathers how to grab it in different languages and where the value shows up in real use: tokens, request signing, caching.
Always in milliseconds: for seconds you need to divide by 1000 and truncate.
time.time() on its own returns a float with sub-second fractions; int() truncates it to the whole number most APIs expect.
Reads straight from the OS clock, useful for naming log files or stamping builds inside a script.
It is the number of seconds (or milliseconds in JavaScript) elapsed since 1 January 1970 at 00:00:00 UTC. Also called Epoch time or POSIX time, it is the universal format for representing time instants in computing systems.
It depends on who consumes the value. JWT tokens (RFC 7519) require NumericDate in seconds for the iat and exp claims; API signatures like AWS SigV4 also use seconds. Using milliseconds there by mistake does not throw an immediate error, it produces an expiry date roughly a thousand times further out than intended.
Not on its own: the value is a snapshot of the instant the page loaded or you asked it to refresh. A live clock would need to call Date.now() again on every tick, and even then the result depends on the device's local clock, which can sit a few seconds out of sync with an NTP server.
No. RFC 7231 defines the Date header in IMF-fixdate format, for example Tue, 15 Apr 2025 12:00:00 GMT, human-readable text, not a number of seconds since 1970. The Unix timestamp shows up in application payloads and token claims, not in standard HTTP date headers.