Unix epoch timestamp
Also called epoch time, Unix time, POSIX time, unixMillis
A Unix epoch timestamp is the number of seconds, or milliseconds (often called unixMillis), since 00:00:00 UTC on 1 January 1970, ignoring leap seconds. In JavaScript, Date.now() returns milliseconds, so divide by 1000 and round down to get seconds. Store it as a JSON number and document the unit, and use Intl.RelativeTimeFormat to show the gap from now as text like "3 hours ago".
In more detail
A Unix epoch timestamp counts the time since 00:00:00 UTC on 1 January 1970, the Unix epoch. It ignores leap seconds and has no time zone, so the same number means the same instant everywhere.
There are two common units. Unix seconds is what most servers, databases and JWT claims such as exp and iat use. Milliseconds, often named unixMillis or epochMillis, is what JavaScript's Date.now() returns. A seconds value today has 10 digits and a milliseconds value has 13, which is the quickest way to tell them apart.
JSON has no date type, so a timestamp travels as a number (or as an ISO 8601 string). Name the field so the unit is obvious, such as createdAtMs, because a seconds value read as milliseconds lands in January 1970.
To show a timestamp as text like "3 hours ago", compute the difference from now and format it with Intl.RelativeTimeFormat, which handles plurals and languages for you.
Example
const ms = Date.now() // 1783497600000 (milliseconds)
const seconds = Math.floor(ms / 1000) // 1783497600 (Unix seconds)
new Date(seconds * 1000).toISOString() // "2026-07-08T08:00:00.000Z"
// Relative time with Intl.RelativeTimeFormat
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" })
const hours = Math.round((seconds * 1000 - Date.now()) / 3_600_000)
rtf.format(hours, "hour") // e.g. "3 hours ago"