What is a Unix Timestamp and How to Convert It
Logs show 13 digits; docs say seconds. The wrong unit yields 1970 or a far-future date. Count digits first, then worry about timezones.
What is a Unix timestamp?
Unix time counts seconds (sometimes milliseconds) since 1970-01-01 00:00:00 UTC. The number itself has no timezone: the same instant is the same epoch everywhere. “Beijing time” is that instant formatted on a CST clock.
Ten digits are usually seconds; thirteen are milliseconds. Date.now() is ms; many databases and JWT exp values are seconds. Treat ms as seconds and you jump tens of thousands of years; treat seconds as ms and you land in January 1970.
It is not a calendar string. Store epoch for sorting and comparison; format for humans. Use the timestamp converter for seconds/ms, Beijing time, and UTC.
Why convert?
Logs, metrics, object-store timestamps, and payment callbacks often ship a number. Nobody subtracts 1719936000 in their head. The converter’s job is: pick the unit, then format in a zone.
Meetings across cities are a different job: same epoch, different wall clocks, sometimes DST. Adding eight hours by habit fails. Use timezone conversion.
JWTs, cron, and certificates all touch time. Cron expressions do not even contain a zone—see the cron guide.
How to convert
Count digits: 10 → seconds, 13 → milliseconds. Do not multiply by 1000 “just in case”. If one side of the converter shows 1970, the unit is wrong.
Date to epoch: know whether the API wants seconds or ms, and which wall clock you typed. Midnight UTC and midnight CST are different instants.
In code, time.Unix, fromtimestamp, and new Date(ms) disagree on units. JavaScript’s Date eats milliseconds.
1970, 2038, and DST
A 1970 result is usually a unit error, not a dead server. A far-future date is often ms parsed as seconds.
Signed 32-bit seconds overflow in 2038. That is unrelated to 13-digit millisecond values.
Mainland China has no DST (UTC+8). US and Europe need tz databases. Epoch ↔ display on the timestamp page; city-to-city on the timezone page. More links sit on the time hub.
Related tools
FAQ
10 vs 13 digits?
Seconds vs milliseconds. Mixing them yields 1970 or a ridiculous future date.
Does the timestamp include a timezone?
No. It is an elapsed duration from UTC. Zones only affect display.
Why 1970?
Seconds passed to a millisecond API (JS Date), or a zero/empty value.
Beijing vs UTC?
UTC+8 with no DST in mainland China. Do not use a fixed eight hours for other countries.
JWT exp unit?
Seconds per spec. Milliseconds push expiry into the far future.