Timestamp Conversion: Seconds, Milliseconds, Time Zones and 2038

Open Tool Timestamp Converter

Where the clock starts

A Unix timestamp counts seconds since midnight UTC on 1 January 1970, excluding leap seconds. It names an absolute instant, independent of time zone; the same value means the same moment everywhere, only rendering differs. Choosing the wrong zone here shifts results by eight hours, the commonest confusion. Beijing time runs eight hours ahead, so its numbers are larger for the same instant.

Steps

  1. Pick the direction: timestamp to date, or date to timestamp.
  2. Choose the display zone, UTC+8 or UTC.
  3. Choose the unit: auto-detect ten-digit seconds or thirteen-digit milliseconds, or force either.
  4. Paste content one value per line, with a single-value field for zone comparison.
  5. Convert, copy, export CSV, or load the sample.

Ten digits versus thirteen

Ten digits mean seconds; thirteen mean milliseconds. Seconds sit at ten digits in the mid-2020s while milliseconds need thirteen, which is how auto-detect decides. Eleven and twelve digits are ambiguous — a future second value or a truncated millisecond one. Interfaces should state the unit explicitly rather than guess. Databases prefer native time types, or milliseconds as integers at worst.

Why zones bite

The same value renders as Beijing time in UTC+8 and eight hours earlier in UTC, and crossing midnight changes the date: sixteen hundred UTC on 31 December is midnight on 1 January locally. Log analysis without a zone assumption inverts cause and effect. Daylight saving adds two offsets in one region, so a fixed offset errs by an hour twice a year; the two common zones here cover the simple cases, while full DST rules need a time-zone library.

The 2038 boundary

A signed thirty-two-bit integer tops out at 2,147,483,647 seconds, which is 19 January 2038 at 03:14:07 UTC. Systems storing seconds in that width overflow to negative and jump back to 1901 — not a distant concern, since older columns, embedded devices and 32-bit programs persist. Fix with sixty-four bits or native time types. Millisecond values overflow far sooner and already require sixty-four bits.

Common problems:Mixing seconds and milliseconds between client and server yields dates millennia away. Formatting locally and treating that string as canonical loses the instant. Ignoring leap seconds matters for astronomy and precise scheduling. Floating-point storage rounds large values to neighbouring seconds. And year boundaries swap when converting across zones at year end.

When conversion is not enough:Migration from local-time strings to UTC timestamps demands verifying each source zone or whole batches shift. Reporting that aggregates by day must fix which zone defines a day, especially across regions. Scheduling must state whether triggers use UTC or local time, because DST transitions invite missed or doubled runs. These need rules in the design, not a one-off conversion.

⏫︎