跳到主要内容
时间戳转换

现在:

1720108757

控制:

时间戳

北京时间

时间

北京时间

时间戳

Unix 时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒。

获取当前时间戳
语言代码
c
int timestamp = time(NULL);
cpp
using namespace std::chrono;
auto now = system_clock::now().time_since_epoch();
auto timestamp = duration_cast<seconds>(now).count();
javascript
Math.round(new Date() / 1000);
SQLite
SELECT strftime('%s', 'now');
Lua
os.time();