Unix timestamps explained without the mystique
A Unix timestamp is a count of seconds (or milliseconds) since1970-01-01T00:00:00Z, ignoring leap seconds in most everyday systems. It is not “Pacific time” or “China time.” It is an absolute instant. Time zones only appear when you format that instant for a human or schedule.
Seconds vs milliseconds
Classic Unix APIs and many databases use seconds. Browser JavaScriptDate.now() returns milliseconds. Mixing them produces dates in 1970 or in the far future. A practical heuristic: if the absolute value has 12+ digits, you are probably looking at milliseconds; 10 digits is usually seconds for contemporary dates.
The wrong question: “What timezone is this timestamp?”
Epoch values do not carry a timezone. If two services disagree, one of them converted using the wrong zone when creating or displaying the number—or stored a naive local clock reading as if it were UTC. Fix the conversion boundaries; do not invent a timezone field on the integer.
Storage tips that age well
- Prefer
timestamptz(or epoch integers with a documented unit) over naive timestamps when your stack supports it. - Log both epoch and a UTC ISO string during incidents.
- Document whether APIs speak seconds or milliseconds—do not make clients guess.
Try it
Use the Unix Timestamp Converter to translate a value from logs, then walk the timezone debugging checklistif services still disagree.