什麼是 Unix 時間戳記轉換器?

免費線上 Unix 時間戳記轉換器。將 Unix 時間戳記轉換為 ISO、本地與 UTC 格式的日期,或將日期轉換為時間戳記。

Unix 時間戳是電腦表示時間的標準方式——一個從 1970 年 1 月 1 日 UTC 起算的整數秒數(或毫秒數)。雖然對機器而言很有效率,但這些數字若不經過轉換,對人類來說毫無意義。Unix 時間戳轉換器提供 Unix 時間戳與人類可讀日期之間的雙向轉換,同時支援秒與毫秒精確度。

此工具可朝兩個方向運作。在「時間戳轉換為日期」模式下,輸入 Unix 時間戳(秒用 10 位數,毫秒用 13 位數),即可同時看到對應日期以多種格式顯示:ISO 8601(2024-01-15T10:30:00.000Z)、當地時間(您瀏覽器的時區)、UTC 時間,以及相對格式(「3 小時前」或「2 天後」)。自動偵測功能會根據位數判斷您輸入的是秒還是毫秒。

在「日期轉換為時間戳」模式下,使用日期選擇器挑選日期與時間,工具就會顯示對應的 Unix 時間戳,同時提供秒與毫秒兩種格式。當您需要為特定未來事件產生時間戳時——例如排定任務或在 JWT 權杖中設定到期日——或是需要將日誌中的人類可讀日期轉回時間戳形式以供查詢時,這個功能就非常實用。

即時的目前時間戳顯示每秒更新,以秒與毫秒兩種格式精確顯示當下的 Unix 時間。對需要頻繁取得目前時間戳以進行 API 呼叫、資料庫查詢或除錯工作的開發者而言,這是相當方便的參考。所有轉換都在本地端完成,不需任何網路請求。

Unix 時間戳記轉換器的實際應用案例

使用時間戳除錯 API 日誌

您的 API 日誌顯示在 Unix 時間戳 1705315200 出現錯誤。將它輸入「時間戳轉換為日期」模式。工具顯示這是 2024 年 1 月 15 日 10:40:00 UTC(或您當地時間的對應時刻)。檢查當時是否發生任何部署或設定變更,以找出根本原因。

在 JWT 權杖中設定到期日

您需要產生一個 7 天後到期的 JWT。使用「日期轉換為時間戳」模式:在日期選擇器中挑選今天的日期加 7 天。工具會傳回以秒為單位的 Unix 時間戳。將該值用作 JWT 承載中的 exp 宣告。再把時間戳轉回人類可讀日期,以驗證期間是否正確。

轉換資料庫時間戳以製作報表

您的資料庫將所有事件時間戳儲存為 Unix 毫秒(13 位數)。從 SQL 查詢匯出一組時間戳,逐一透過工具轉換,即可取得供商業報表使用的 ISO 8601 日期。多種格式的輸出讓您能複製符合報表工具需求的日期格式。

為什麼要使用 Unix 時間戳記轉換器?

  • 雙向轉換:時間戳轉日期與日期轉時間戳
  • Supports both seconds and milliseconds
  • Multiple output formats: ISO 8601, local, UTC, relative
  • Live current timestamp display

如何使用 Unix 時間戳記轉換器 — 逐步教學

1

For timestamp to date: enter a Unix timestamp (seconds or ms).

2

View the formatted date in ISO, local, UTC, and relative formats.

3

For date to timestamp: pick a date and time.

4

View and copy the resulting Unix timestamp.

Unix 時間戳記轉換器適合誰?

  • API 除錯
  • 日誌分析
  • 資料庫查詢
  • 排程任務

Unix 時間戳記轉換器專業技巧

  • 1記住 10 位數與 13 位數的規則:2286 年以前(以秒計)的時間戳為 10 位數。JavaScript 的 Date.now() 回傳 13 位數(毫秒)。多數資料庫儲存秒數(10 位數)。
  • 2ISO 8601 格式(2024-01-15T10:30:00.000Z)是 API 通訊與資料交換最安全的選擇,因為它具備時區感知且可被機器解析。
  • 3查詢具有時間戳範圍的資料庫時,請先將您的人類可讀日期範圍轉換為時間戳。例如,「過去 24 小時」等於現在 - 86400(以秒計)或現在 - 86400000(以毫秒計)。
  • 4相對格式(「2 小時前」)有助於快速評估事件的時間近程。在日誌分析中使用它,可在不需對絕對時間戳進行心算的情況下找出近期的錯誤。

Unix 時間戳記轉換器 — 常見問題

What is a Unix timestamp?

A Unix timestamp is the number of seconds (or milliseconds) that have elapsed since January 1, 1970 UTC (the Unix Epoch). It is widely used in databases, APIs, and logging systems.

How do I know if my timestamp is in seconds or milliseconds?

Timestamps in seconds are typically 10 digits (e.g., 1700000000), while milliseconds are 13 digits (e.g., 1700000000000). The converter auto-detects based on the digit count.

Can I use these tools with sensitive/proprietary data?

Absolutely. All processing runs locally in your browser with zero server uploads. This makes these tools safe for proprietary code, internal API keys, and confidential data.

Do these tools work offline?

Yes, once the page has loaded, most developer tools continue functioning without an internet connection. This makes them ideal for air-gapped environments or travel.

What browsers are supported?

All modern browsers are supported: Chrome, Firefox, Safari, and Edge. Internet Explorer is not supported. The tools leverage modern JavaScript APIs like Web Crypto, TextEncoder, and BigInt.

準備好使用 Unix 時間戳記轉換器 了嗎?

免費線上工具 — 在瀏覽器中運作,無需註冊。立即開始使用。

立即試用
Free Forever · No Sign-up

182 Free Tools at Your Fingertips

All free online tools for developers, designers, students, and creators. Every tool works in your browser — no sign-up, no data collection.