F

时间戳转换Timestamp Converter

Unix时间戳与日期时间互相转换Convert between Unix timestamps and date/time.

当前时间戳

0

关于 时间戳转换About Timestamp Converter

Unix 时间戳以 1970-01-01 00:00:00 UTC 为起点计数,是数据库、日志与 API 中最通用的时间表示。本工具支持秒级(10 位)与毫秒级(13 位)时间戳与本地日期时间双向转换,自动识别位数,是排查时间问题的常备工具。Unix timestamps count from 1970-01-01 00:00:00 UTC and are the most universal time representation in databases, logs and APIs. This tool converts between second (10-digit) or millisecond (13-digit) timestamps and local date-times in both directions, auto-detecting the digit count.

使用方法How to Use

  1. 点击「现在」获取当前时间戳,或直接粘贴待转换的时间戳。Click "Now" for the current timestamp, or paste a timestamp to convert.
  2. 工具自动识别秒级与毫秒级并转换为本地日期时间。The tool auto-detects seconds vs milliseconds and shows the local date-time.
  3. 反向转换时,在日期时间选择器中选择目标时间,得到对应时间戳。For the reverse direction, pick a target date-time to get its timestamp.
  4. 复制结果用于代码、日志分析或接口调试。Copy the result for code, log analysis or API debugging.

常见问题FAQ

如何区分秒和毫秒时间戳?How do I tell seconds from milliseconds?

秒级为 10 位、毫秒级为 13 位。工具会自动识别,但写代码时务必与接口约定一致——秒/毫秒混用是“时间差了 1000 倍”bug 的头号来源。Seconds have 10 digits, milliseconds 13. The tool auto-detects, but in code always match your API’s convention — mixing them is the top cause of "time off by 1000x" bugs.

为什么转换结果差了 8 小时?Why is the converted time off by 8 hours?

时间戳本身不含时区,展示时按本地时区解释。差 8 小时通常是服务器按 UTC 记录、而你在东八区查看(或相反),核对双方时区即可。Timestamps carry no timezone; display interprets them in your local zone. An 8-hour offset usually means the server logged in UTC while you view in UTC+8 (or vice versa) — reconcile the zones.

为什么起点是 1970 年?Why does it start in 1970?

这源于早期 Unix 系统的纪元(Epoch)设定,后来成为行业惯例,Linux、Java、JavaScript 等皆沿用至今。It comes from the epoch chosen by early Unix systems and became an industry convention, inherited by Linux, Java, JavaScript and friends.

13 位数字和 10 位数字有什么区别?What is the difference between 13-digit and 10-digit numbers?

13 位是毫秒(如 JavaScript Date.now()),10 位是秒(如 MySQL UNIX_TIMESTAMP())。本工具自动识别两种单位并互相换算。13 digits are milliseconds (JS Date.now()), 10 digits are seconds (MySQL UNIX_TIMESTAMP()). This tool auto-detects both units and converts between them.

转换结果受时区影响吗?Do the results depend on timezone?

时间戳本身不含时区信息。本工具会同时显示 UTC 时间与你的本地时区时间,避免常见的 8 小时误差。A timestamp itself carries no timezone. This tool shows UTC and your local time side by side, avoiding the classic 8-hour error.

相关阅读Related Reading

相关工具Related Tools