⏱

Unix Timestamp Converter

Convert dates to Unix seconds or milliseconds and convert timestamps back

—Unix seconds
—Unix milliseconds
Local date and time
UTC date and time

Unix Timestamp Converter — what it does

Convert a date and time into Unix seconds and milliseconds, or turn a timestamp back into local and UTC date-times. Unix time counts seconds since 1 January 1970 UTC, and it is what logs, APIs and databases store because a single integer has no time zone ambiguity.

Worked example

Two date-times converted to timestamps and two timestamps converted back, measured in a browser whose time zone is America/Los_Angeles; the date-time field is read in that zone.

DirectionInputResult
Date → timestamp2026-10-20 09:00 (local, America/Los_Angeles)1792512000 s · 1792512000000 ms · Tue, 20 Oct 2026 16:00:00 GMT
Date → timestamp1970-01-01 00:00 (local)28800 s · 28800000 ms · Thu, 01 Jan 1970 08:00:00 GMT
Timestamp → date1767225600Thu, 01 Jan 2026 00:00:00 GMT · local Wed Dec 31 2025 16:00:00 GMT-0800
Timestamp → date1767225600000Thu, 01 Jan 2026 00:00:00 GMT · local Wed Dec 31 2025 16:00:00 GMT-0800

Local midnight on 1 January 1970 is 28800, not 0, because the browser was eight hours behind UTC; the same input in a UTC+8 browser would give -28800.

When this tool helps

  • Reading a timestamp from a log file, API response or database column.
  • Producing a timestamp value to use in a query or a request parameter.
  • Checking a token's expiry claim by converting it to a readable time.

How to use it

  1. Enter a date and time, or use the current time.
  2. Read the Unix seconds and milliseconds values.
  3. Or paste a timestamp to convert back.
  4. Read the local and UTC date-times.

Accuracy, limits, and good practice

  • Ten digits is seconds and thirteen is milliseconds — mixing them up puts your date in 1970 or fifty thousand years into the future.
  • Unix time is always UTC. The local rendering is a display convenience, and the stored number carries no zone at all.
  • JavaScript works in milliseconds while most backend languages default to seconds, which is the classic source of off-by-1000 bugs.

Frequently asked questions

Why does 1970 keep appearing?

Because a value of zero or a null is the Unix epoch itself. A date of 1 January 1970 nearly always means a missing timestamp.

What is the 2038 problem?

Signed 32-bit timestamps overflow in January 2038. Modern systems use 64-bit values, which push the limit far beyond any practical horizon.

Does Unix time include leap seconds?

No, it deliberately ignores them, which keeps arithmetic simple at the cost of tiny divergences from astronomical time.

How does the tool decide whether a timestamp is in seconds or milliseconds?

By length: a value with ten digits or fewer before the decimal point is treated as seconds and multiplied by 1000, anything longer as milliseconds. That is why 1767225600 and 1767225600000 give the same date. A fractional value such as 1767225600.9 is accepted and lands 900 ms later, though the display only shows whole seconds.

Why is my 1970-01-01 00:00 not zero?

The date-time field is interpreted in your browser's time zone, so local midnight is 0 only in UTC. The "Unix seconds" value is always UTC-based, and the local and UTC renderings underneath show the same instant in both forms. Negative timestamps for dates before 1970 are accepted.

Related tools on this site

Everything above runs inside this page. Unix Timestamp Converter needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

Unix 時間戳轉換器能做什麼

把日期時間轉成 Unix 秒與毫秒,或把時間戳轉回當地與 UTC 的日期時間。Unix 時間計的是自 1970 年 1 月 1 日 UTC 起的秒數,日誌、API 與資料庫都存它,因為單一整數不會有時區歧義。

實際範例

兩個日期時間換成時間戳、兩個時間戳換回日期,在時區為 America/Los_Angeles 的瀏覽器中量測;日期時間欄位以該時區解讀。

方向填寫值顯示值
日期 → 時間戳2026-10-20 09:00(當地,America/Los_Angeles)1792512000 s · 1792512000000 ms · Tue, 20 Oct 2026 16:00:00 GMT
日期 → 時間戳1970-01-01 00:00(當地)28800 s · 28800000 ms · Thu, 01 Jan 1970 08:00:00 GMT
時間戳 → 日期1767225600Thu, 01 Jan 2026 00:00:00 GMT · 當地 Wed Dec 31 2025 16:00:00 GMT-0800
時間戳 → 日期1767225600000Thu, 01 Jan 2026 00:00:00 GMT · 當地 Wed Dec 31 2025 16:00:00 GMT-0800

1970 年 1 月 1 日的當地午夜是 28800 而不是 0,因為該瀏覽器比 UTC 慢八小時;同樣的值在 UTC+8 的瀏覽器會得到 -28800。

什麼時候用得上

  • 讀取日誌、API 回應或資料庫欄位中的時間戳。
  • 產生查詢或請求參數要用的時間戳數值。
  • 把權杖的到期宣告轉成看得懂的時間。

使用步驟

  1. 輸入日期時間,或使用目前時間。
  2. 查看 Unix 秒與毫秒數值。
  3. 或貼上時間戳進行反向轉換。
  4. 查看當地與 UTC 的日期時間。

精確度、限制與實務建議

  • 十位數是秒、十三位數是毫秒——搞混會讓日期跑到 1970 年,或飛到五萬年後。
  • Unix 時間永遠是 UTC。當地時間只是顯示上的方便,儲存的數字本身完全不帶時區。
  • JavaScript 用毫秒,多數後端語言預設用秒,這正是經典的差一千倍錯誤來源。

常見問題

為什麼一直出現 1970 年?

因為值為 0 或 null 就是 Unix 紀元本身。日期顯示 1970 年 1 月 1 日,幾乎都代表時間戳遺失。

什麼是 2038 年問題?

有號 32 位元時間戳會在 2038 年 1 月溢位。現代系統改用 64 位元,上限已遠超任何實務考量。

Unix 時間有含閏秒嗎?

沒有,它刻意忽略閏秒,換得運算簡單,代價是與天文時間有極小的偏差。

工具怎麼判斷時間戳是秒還是毫秒?

看長度:小數點前十位以內視為秒並乘以 1000,更長則視為毫秒。所以 1767225600 與 1767225600000 會得到同一個日期。帶小數的值(例如 1767225600.9)可以接受,會落在 900 毫秒之後,但顯示只到整秒。

為什麼我填 1970-01-01 00:00 不是 0?

日期時間欄位以你瀏覽器的時區解讀,只有在 UTC 下當地午夜才是 0。「Unix 秒」的值永遠以 UTC 為準,下方的當地與 UTC 兩種寫法顯示的是同一個瞬間。1970 年以前的負時間戳也可以接受。

本站相關工具

以上步驟全部在這個頁面內完成,Unix 時間戳轉換器 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。