What Is a Unix Timestamp? Seconds, Milliseconds & Time Zone Conversion

Reading logs or calling APIs, you constantly run into 10- or 13-digit numbers like 1727222400. That's a Unix timestamp: the number of seconds (or milliseconds) since January 1, 1970, 00:00 UTC. It's the computer world's universal time language.

But human brains don't translate 1727222400 into "September 25, 2024" on sight. This article explains the conversion logic, with a free converter at the end.

Seconds vs milliseconds: a 1000× trap

A 10-digit number is a second-level timestamp (e.g. 1727222400); a 13-digit one is millisecond-level (e.g. 1727222400000). They differ by a factor of 1000 — the most common beginner trap: treat a millisecond stamp as seconds and you land in 1970; the other way around lands you tens of thousands of years in the future.

Memory aid: seconds are 10 digits, milliseconds are 13. Java's System.currentTimeMillis() and JavaScript's Date.now() return 13-digit millisecond stamps; Python's time.time() and PHP's time() return seconds (float or integer). Check which unit the API docs ask for before integrating.

Converting timestamps to Beijing Time

Conversion is two steps: turn the timestamp into UTC time, then add 8 hours for Beijing Time (UTC+8). For example, timestamp 1727222400 is 2024-09-25 00:00:00 UTC, which is 2024-09-25 08:00:00 Beijing Time.

The time zone step is where manual math usually goes wrong: people forget the 8-hour offset, get a result "off by 8 hours," and blame the tool — when really UTC and Beijing Time are simply 8 hours apart. When using a converter, confirm its output is in Beijing Time (UTC+8).

  1. Confirm whether the timestamp is 10 digits (seconds) or 13 digits (milliseconds).
  2. Paste the number into the converter's timestamp input — the tool auto-detects the unit.
  3. Click convert to get Beijing Time in YYYY-MM-DD HH:mm:ss format.
  4. Reverse: pick a date and time in the date picker to get both second- and millisecond-level timestamps in one click.
💡 Rather skip the reading? Try it yourself
Open the free "Timestamp Converter" tool — runs locally, no sign-up.
Use Timestamp Converter Free →

Common uses of timestamps

One: API signatures — many APIs use timestamps as a request "expiry" check to prevent replay attacks. Two: log ordering — comparing numbers is far faster than comparing date strings, so logging systems record events as timestamps. Three: cache expiry — e.g. "token expires in 2 hours" is stored as "current timestamp + 7200".

Once you understand timestamps, reading logs and debugging "why does my request say expired?" gets much smoother: convert the timestamp in the log and you'll know exactly which second went wrong.

FAQ

How do I tell if a timestamp is in seconds or milliseconds?
Check the digit count: 10 digits means seconds, 13 means milliseconds — the simplest rule of thumb. The 13-digit millisecond stamp is what JavaScript's Date.now() returns, so it's especially common in frontend development.
Do timestamps have time zones? Why is my conversion off by 8 hours?
A timestamp has no time zone — it's a single point in UTC time. Time zones only matter when displaying it as a clock time: the same timestamp shows as 20:00 in Beijing and 12:00 in London.
My timestamp looks wrong — how do I verify it?
Get "right now" in seconds from a current-timestamp tool and compare it with yours: a few minutes off is normal (different generation times), several hours off is likely a time zone misunderstanding, and a 1000× difference usually means seconds and milliseconds got mixed up.
Is the 2038 problem real?
On January 19, 2038, the largest second-level timestamp a signed 32-bit integer can hold will overflow. Mainstream systems have already migrated to 64-bit, so there's nothing to worry about in everyday use.

Related Tutorials

Related Tools

📄 SyncPage — real-time document collaboration Review PDFs, slides, Word & Excel files together — present live, annotate in real time, talk by voice. Guests join free from an invite link. Try SyncPage →