Unix 时间戳转日期

将数字时间戳转换显示为 UTC 与您本地的清晰日期时间。

Timestamp → date & time

10 digits = seconds · 13 digits = milliseconds (auto-detect explains which it used).

计算原理

  1. A timestamp marks one exact instant; the unit (seconds or milliseconds) tells how finely it counts since 1970-01-01T00:00:00Z.
  2. Auto-detect labels its choice: values under 100,000,000,000 are read as seconds, larger values as milliseconds, and the note under the result tells you which was applied.
  3. The decoded instant is rendered in UTC and in your browser’s local zone, so an instant near midnight is never mistaken for “the wrong day”.

使用提示

  • Negative values decode normally; -1 is one second before the epoch (1969-12-31 23:59:59 UTC).
  • Range limit: ±8,640,000,000,000,000 ms (the JavaScript Date limits, about years −271,821 to 275,760). Values outside are rejected, not wrapped.
  • Fractional seconds are rounded to the nearest millisecond, and the note says so.

常见问题解答

How do I know if my timestamp is seconds or milliseconds?
Count the digits: 10 digits (e.g. 1700000000) is seconds; 13 digits (1700000000000) is milliseconds. Auto-detect states which unit it applied, without silent guessing.
Why does the UTC date differ from the local date?
A timestamp is one instant; local calendars slice it differently. An instant near midnight UTC can be “yesterday” in New York and “tomorrow” in Tokyo. Both views are shown together.
Are negative timestamps supported?
Yes, pre-1970 instants are negative and decode normally; for example, −1 is one second before the epoch (1969-12-31 23:59:59 UTC).