时间戳转换器

时间戳转日期

时间戳转日期

当前 Unix 时间戳: 1774630069
单位:auto · s · ms · μs · ns
本地时间2026-03-27 16:47:49
UTCFri, 27 Mar 2026 16:47:49 GMT
1774630069
毫秒1774630069000
微秒1774630069000000
纳秒1774630069000000000

日期转时间戳

日期选择:

1774630069
毫秒1774630069000
微秒1774630069000000
纳秒1774630069000000000

什么是 Unix 时间戳?

Unix 时间戳(也称 Unix time 或 POSIX time)是从 1970-01-01 00:00:00 UTC 开始经过的秒数。

它是跨系统存储和比较时间的便捷方式。大多数系统把它当作连续秒计数,并不计算闰秒。

部分 32 位系统会在 2038 年溢出(2038 年问题)。

代码示例

获取当前 epoch 时间,并将 epoch 时间戳转换为可读日期(替换 1800000000.

JavaScript
// now (seconds)
Math.floor(Date.now() / 1000)

// epoch -> date
new Date(1800000000 * 1000).toISOString()
Python
import time

# now (seconds)
int(time.time())

# epoch -> date (local)
time.ctime(1800000000)
Go
package main

import (
  "fmt"
  "time"
)

func main() {
  fmt.Println(time.Now().Unix())
  fmt.Println(time.Unix(1800000000, 0).UTC())
}
SQL (PostgreSQL)
-- now (seconds)
SELECT EXTRACT(EPOCH FROM now());

-- epoch -> timestamp
SELECT TO_TIMESTAMP(1800000000);
Unix/Linux shell
date +%s
date -d @1800000000
macOS
date +%s
date -j -r 1800000000