时间戳转换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
- 点击「现在」获取当前时间戳,或直接粘贴待转换的时间戳。Click "Now" for the current timestamp, or paste a timestamp to convert.
- 工具自动识别秒级与毫秒级并转换为本地日期时间。The tool auto-detects seconds vs milliseconds and shows the local date-time.
- 反向转换时,在日期时间选择器中选择目标时间,得到对应时间戳。For the reverse direction, pick a target date-time to get its timestamp.
- 复制结果用于代码、日志分析或接口调试。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
Cron 表达式实战:6 个高频调度场景与 Linux/Quartz 的字段差异Cron Expressions in Practice: 6 Common Scheduling Scenarios and the Linux/Quartz Field Difference
Cron 表达式看起来只有五六个字段,但"每 5 分钟"和"每 5 分钟从第 3 分开始"是两回事,Linux cron 和 Quartz 的字段数还不一样。本文用 6 个真实场景把写法讲透,附字段差异对照表A cron expression looks like just five or six fields, but "every 5 minutes" and "every 5 minutes starting from minute 3" are different things — and Linux cron and Quartz don't even have the same number of fields. This article works through six real scenarios and includes a field-difference comparison table.
JWT 解析的 5 个常见报错:签名失效、过期、算法混淆与排查清单5 Common JWT Parsing Errors: Invalid Signature, Expiry, Algorithm Confusion and a Debug Checklist
JWT 看起来就是三段 Base64URL 拼起来的字符串,但实际联调时签名失效、过期、算法不匹配这类报错能耗掉大半天。本文整理我踩过的 5 个高频坑,附一个可直接照着走的排查清单A JWT looks like three Base64URL segments glued together, but in real integrations, invalid signatures, expiry and algorithm mismatches can eat half a day. This article collects five high-frequency pitfalls I've hit, plus a debug checklist you can follow step by step.