时间戳转换

Unix 时间戳与日期时间相互转换

当前时间戳

Unix 时间戳 (秒)
1772272847
Unix 时间戳 (毫秒)
1772272847821
本地时间:2026/2/28 10:00:47

时间戳转日期

本地时间 (Local)
等待输入...
格林威治时间 (UTC)
等待输入...

日期转时间戳

Unix 时间戳 (秒)
---
Unix 时间戳 (毫秒)
---

单位换算

1 分钟60
1 小时3,600
1 天86,400
1 周604,800
1 个月 (30.44天)2,629,743
1 年 (365.24天)31,556,926

常见语言

JavaScript
Math.floor(Date.now() / 1000)
Python
import time; int(time.time())
Java
System.currentTimeMillis() / 1000
PHP
time()
Go
time.Now().Unix()
Shell
date +%s
C++
std::time(nullptr)
Rust
SystemTime::now().duration_since(UNIX_EPOCH).as_secs()