Epoch 时间转换器

即时转换 Unix 时间戳和人类可读的日期格式。支持秒、毫秒、微秒和纳秒,并实时显示时间戳。

当前 Unix 时间戳
Live
1778529188

纪元 → 日期

Get Current Epoch in Your Language

JavaScript
Math.floor(Date.now() / 1000)
Python
import time; int(time.time())
PHP
time()
Java
System.currentTimeMillis() / 1000L
Go
time.Now().Unix()

How to Use the Unix Epoch Converter

Easily convert between Unix timestamps and human-readable dates. Unix time (also known as POSIX time or Epoch time) is a system for describing points in time, defined as the number of seconds that have elapsed since January 1, 1970 (UTC).

Epoch to Human

Paste any Unix timestamp (seconds or milliseconds) to see it converted instantly into Local Time, UTC, and ISO 8601 formats. The tool automatically detects the precision.

Human to Epoch

Select a date and time using the pickers to generate the corresponding Unix timestamp. This is essential for setting expiration times in tokens or database queries.

Did You Know?

The "Year 2038 problem" (also known as Y2K38) refers to the end of Unix time for 32-bit systems. On January 19, 2038, the signed 32-bit integer used to store the timestamp will overflow, potentially causing system failures. Modern 64-bit systems solve this, extending the limit billions of years into the future.

Explore Related Time Tools

Frequently Asked Questions

为什么要使用我们的纪元时间转换器?

实时更新

每秒更新一次的实时 Unix 时间戳。

多种格式

转换为秒、毫秒、微秒和纳秒。

快速预设

一键按钮,用于设置“现在”和“一天开始”等常用时间戳。

可嵌入小部件

复制嵌入代码,即可在您的网站上添加实时时间戳。

了解 Unix 时间戳

Unix 时间戳是计算机的基础,广泛应用于数据库、API、日志文件和编程中。我们的转换器可以帮助开发人员、系统管理员以及所有处理时间数据的人员快速地在人类可读的日期和 Unix 时间之间进行转换。

常见用例

  • 数据库时间戳为了提高效率,许多数据库将日期存储为 Unix 时间戳。
  • API响应REST API 通常以 Unix 时间戳格式返回时间戳
  • 日志分析服务器日志通常使用 Unix 时间戳进行精确计时。
  • 文件元数据文件系统以时间戳的形式记录创建和修改时间。

编程语言示例

不同的编程语言对 Unix 时间戳的处理方式不同。JavaScript 使用毫秒(Date.now()),而 Python 的 time.time() 返回秒。PHP 的 time() 也返回秒。我们的转换器可以自动处理这两种格式。

JavaScript(返回毫秒数)

Date.now(); // → 1747842600000

Math.floor(Date.now() / 1000); // → 1747842600(秒)

Python(返回秒数)

import time

time.time(); # → 1747842600.123

int(time.time()); # → 1747842600

PHP(返回秒数)

time(); // → 1747842600

microtime(true); // → 1747842600.123

Go(返回 Time 结构体;.Unix() 表示秒数)

import "time"

time.Now().Unix() // → 1747842600

time.Now().UnixMilli() // → 1747842600000

Rust(返回自 UNIX_EPOCH 以来的持续时间)

使用 std::time::{SystemTime, UNIX_EPOCH};

SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() // → 1747842600

SQL(PostgreSQL 和 MySQL)

-- PostgreSQL

SELECT EXTRACT(EPOCH FROM NOW())::INT; -- → 1747842600

-- MySQL

SELECT UNIX_TIMESTAMP(); -- → 1747842600

使用 Unix 时间、Epoch 实时数据和时间戳

Unix 时间戳(也称为 Unix 日期时间或 Unix 时间)是几乎所有现代计算系统中表示时间点的实际标准。无论您是在构建后端服务、调试日志还是在 API 之间同步数据,能够快速读取和转换 Unix 时间戳都能节省数小时的手动计算时间。我们的工具提供实时 Unix 时间戳视图,每秒更新一次,让您只需单击一下即可获取任何时刻的精确值。

除了 Unix 工程领域,“epoch”(纪元)一词还出现在许多语境中——从机器学习的训练周期到像《Last Epoch》这样的游戏系列(玩家会在其中追踪版本构建和补丁的时间戳)。无论来源如何,此转换器都接受 10 位(秒)和 13 位(毫秒)的值,并将其转换为 UTC、本地时区、ISO 8601 和 RFC 2822 格式的易于理解的日期。粘贴来自数据库行、JSON 有效负载或服务器日志的时间戳,即可立即并排查看所有格式。

常用时间戳参考

在开发和历史研究中经常出现的值得注意的 Unix 时间戳值。

时间戳日期/事件
01970年1月1日 00:00:00 UTC — Unix纪元
−864001969年12月31日 00:00:00 UTC — 纪元前一天
9466848002000年1月1日 00:00:00 UTC — 新千年的开始
10000000002001年9月9日 01:46:40 UTC — 纪元后10亿秒
12345678902009年2月13日 23:31:30 UTC — 著名的“连续数字”时刻
15000000002017年7月14日 02:40:00 UTC — 纪元后15亿秒
15778368002020年1月1日 00:00:00 UTC — 2020年的开始
17040672002024年1月1日 00:00:00 UTC — 2024年的开始
17356896002025年1月1日 00:00:00 UTC — 2025年的开始
21474836472038-01-19 03:14:07 UTC — 2038 年问题边界(最大有符号 32 位)