Unix时间戳

当前时间
Unix时间戳

北京时间

常用日期格式示例:

日期说明 时间戳 完整日期 2026-06-21 20260621
今天 1781971200 2026-06-21 00:00:00 2026-06-21 20260621
昨天 1781884800 2026-06-20 00:00:00 2026-06-20 20260620
明天 1782057600 2026-06-22 00:00:00 2026-06-22 20260622
前天 1781798400 2026-06-19 00:00:00 2026-06-19 20260619
三天前 1781712000 2026-06-18 00:00:00 2026-06-18 20260618
七天前 1781366400 2026-06-14 00:00:00 2026-06-14 20260614
本周(周日开始)- 周日 1781971200 2026-06-21 00:00:00 2026-06-21 20260621
本周(周日开始)- 周六 1782489600 2026-06-27 00:00:00 2026-06-27 20260627
本周(周一开始)- 周一 1781452800 2026-06-15 00:00:00 2026-06-15 20260615
本周(周一开始)- 周日 1781971200 2026-06-21 00:00:00 2026-06-21 20260621

在编程语言中获取Unix时间戳:

语言 毫秒
JavaScript Math.round(new Date() / 1000) new Date().getTime()
Java System.currentTimeMillis() / 1000 System.currentTimeMillis()
Python int(time.time()) int(time.time() * 1000)
Go time.Now().Unix() time.Now().UnixNano() / 1e6
PHP time() (int)(microtime(true) * 1000)
Ruby Time.now.to_i (Time.now.to_f * 1000).to_i
C# DateTimeOffset.UtcNow.ToUnixTimeSeconds() DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
Swift NSDate().timeIntervalSince1970 NSDate().timeIntervalSince1970 * 1000
Objective-C [[NSDate date] timeIntervalSince1970] [[NSDate date] timeIntervalSince1970] * 1000