Unix 时间戳转换器

当前 Unix 时间戳

0

最后更新:

关于此工具

Unix 时间戳转换器在 1970-01-01 UTC 起的整数秒(Unix epoch)与可读日期时间之间互转。JWT 的 iat/exp、数据库 created_at、日志、文件 mtime 等到处都是,免去每次心算。

使用方法

  1. Read the live "now" timestamp at the top of the page.
  2. Type a Unix timestamp into the input — the human date below updates instantly.
  3. Or pick a date with the picker — the Unix value updates instantly.
  4. Click Now to grab the current timestamp.
  5. Copy whichever representation you need into your code, log query, or test fixture.

常见用例

  • Converting a Stripe charge’s created field into a human date.
  • Decoding the iat / exp claim of a JWT to debug expiration issues.
  • Translating a log file timestamp into your local time zone.
  • Producing a Unix timestamp for an "expires in N seconds" cache entry.
  • Filling out a database test fixture with a known date.
  • Sanity-checking that a server clock matches the expected epoch.

常见问题

Q. Are timestamps in seconds or milliseconds?

A. Both are common. Unix tools and most databases use seconds; JavaScript Date.now() returns milliseconds. A 13-digit number is almost always milliseconds; 10 digits is seconds.

Q. What about time zones?

A. Unix timestamps are always UTC by definition. Display formatting is what introduces local time — store UTC, show local.

Q. Will Unix timestamps overflow in 2038?

A. Signed 32-bit timestamps overflow on 2038-01-19. Modern systems use 64-bit timestamps and are safe for billions of years.

Q. Why do JWT exp values look strange?

A. They are seconds since the epoch. iat is when the token was issued; exp is when it expires. Both are in UTC.