返回此分类
已上线
时间戳转换工具
秒/毫秒时间戳与日期时间互转,按所选时区解析;点击当前时间戳可复制。
当前时间戳
点击上方数字可复制
时间戳 → 日期时间
2026/07/21 08:54:51
日期时间 → 时间戳
日期时间按上方所选时区解析(与「时间戳→日期」共用)
Unix 秒
1784595291
Unix 毫秒
1784595291000
北京时间与夏令时说明
1986–1991 年中国曾实行夏令时(4 月中旬至 9 月中旬将时钟拨快 1 小时),1992 年起不再实行。历史时刻换算需注意当时政策。
浏览器与 JDK 对 Asia/Shanghai 历史夏令时规则可能因版本不同而有差异;涉及时区敏感业务请以权威时区数据库为准。
各语言获取当前 Unix 时间戳
| 语言 | 示例代码 | |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | |
| Python | import time int(time.time()) | |
| Go | time.Now().Unix() | |
| Java | System.currentTimeMillis() / 1000 | |
| PHP | time(); | |
| Shell | date +%s | |
| MySQL | SELECT UNIX_TIMESTAMP(NOW()); | |
| SQLite | SELECT strftime('%s', 'now'); | |
| Ruby | Time.now.to_i | |
| C# | DateTimeOffset.UtcNow.ToUnixTimeSeconds(); | |
| Swift | Int(Date().timeIntervalSince1970) | |
| Dart | (DateTime.now().millisecondsSinceEpoch / 1000).truncate() |