Stax
Tools

ตัวแปลง Timestamp

แปลง Unix timestamps เป็นวันที่อ่านได้ และในทางกลับกัน

Current Unix Timestamp (seconds)
1781950790
Sat, 20 Jun 2026 10:19:50 GMT

Seconds or milliseconds — auto-detected

Unix timestamp คืออะไร?

วินาที vs มิลลิวินาที

กรณีใช้งานทั่วไป

Unix timestamp นับจำนวนวินาทีตั้งแต่วันที่ 1 มกราคม 1970 เวลา 00:00:00 UTC — เรียกอีกอย่างว่า Unix Epoch เป็นการแสดงเวลาที่ใช้กันแพร่หลายที่สุดในการคำนวณ เพราะไม่ขึ้นกับ timezone เก็บเป็น integer ได้ง่าย และเปรียบเทียบและเรียงลำดับได้ง่ายมาก

ระบบต่างๆ ใช้ความแม่นยำที่แตกต่างกัน API/Unix ส่วนใหญ่ใช้วินาที JavaScript, Java และ API สมัยใหม่จำนวนมากใช้มิลลิวินาที PostgreSQL และ MySQL เก็บเป็นวินาทีพร้อมส่วนทศนิยมที่เลือกได้ Redis ใช้มิลลิวินาที เครื่องมือนี้ตรวจจับอัตโนมัติโดยตรวจสอบว่าค่าเกิน 10¹² หรือไม่ (timestamp มิลลิวินาทีโดยประมาณสำหรับปี 2001)

ใน JavaScript, Date.now() ส่งคืนมิลลิวินาที — หารด้วย 1,000 เพื่อรับวินาที ใน Python, time.time() ส่งคืนวินาทีเป็น float ใน PostgreSQL, EXTRACT(EPOCH FROM NOW()) ส่งคืนวินาที ใน Redis, TIME ส่งคืนวินาทีและไมโครวินาทีเป็น integer สองตัว ใน Go, time.Now().Unix() ส่งคืนวินาที; time.Now().UnixMilli() ส่งคืนมิลลิวินาที เครื่องมือนี้ตรวจจับความแม่นยำอัตโนมัติโดยตรวจสอบว่าค่าดูเหมือนตัวเลข 10 หลัก (วินาที) หรือ 13 หลัก (มิลลิวินาที) — วางค่าดิบและมันจะแก้ความคลุมเครือ

Unix timestamp แบบ 32-bit signed จะ overflow ที่ 2,147,483,647 — วันที่ 19 มกราคม 2038 เวลา 03:14:07 UTC ระบบเก่าที่ใช้ integer 32-bit สำหรับ timestamp (ระบบ embedded บางอย่าง, โค้ด C เก่า, ประเภท TIMESTAMP ของ MySQL ก่อน MySQL 8.0.28) จะ wrap เป็นค่าลบหรือเกิด error ระบบ 64-bit สมัยใหม่ขยายช่วงเวลาออกไปประมาณ 292 พันล้านปีในอนาคต ประเภท TIMESTAMP ของ PostgreSQL ใช้ 64-bit และปลอดภัย แอปพลิเคชันเว็บส่วนใหญ่ที่สร้างตั้งแต่ปี 2010 ใช้ integer 64-bit และไม่ได้รับผลกระทบ แต่ระบบเก่าที่ยังใช้งานอยู่ควรได้รับการตรวจสอบและอัปเกรดก่อนปี 2038

ISO 8601 (2026-05-13T10:30:00Z) คือมาตรฐานสมัยใหม่ที่ใช้โดย REST API, ฐานข้อมูล, input datetime ของ HTML และรูปแบบแลกเปลี่ยนข้อมูลอย่าง JSON สามารถเรียงลำดับตามตัวอักษรได้และไม่คลุมเครือในทุก locale RFC 2822 (Tue, 13 May 2026 10:30:00 +0000) เป็นรูปแบบเก่าจากยุค email protocol และเป็นสิ่งที่ Date.toUTCString() ของ JavaScript ผลิตมาในอดีต ให้ใช้ ISO 8601 ในทุกระบบใหม่ — รับได้โดย Date.parse(), Python's datetime.fromisoformat() และ library วันที่แทบทุกตัว ใช้ RFC 2822 เฉพาะเมื่อผสานกับระบบ email เก่าหรือ API รุ่นเก่าที่ต้องการ

  • Debug response ของ API ที่มีฟิลด์ timestamp
  • ตรวจสอบการหมดอายุ JWT (exp claim)
  • อ่าน timestamp ของฐานข้อมูล
  • ตรวจสอบ timestamp ของไฟล์ log
  • กำหนดการหมดอายุของ cache หรือ cookie

คำถามที่พบบ่อย

What is a Unix timestamp?
A Unix timestamp is the number of seconds that have elapsed since the Unix Epoch — midnight UTC on January 1, 1970. It's a universal, timezone-independent way to represent a specific moment in time. It increases by 1 every second and is used in virtually every programming language and database.
Seconds vs milliseconds — which does my system use?
Most Unix systems and databases store timestamps in seconds (10 digits as of 2025: e.g. 1700000000). JavaScript's Date.now() returns milliseconds (13 digits: e.g. 1700000000000). This tool auto-detects: if the value is greater than 10^12, it assumes milliseconds.
What is the maximum Unix timestamp?
The Unix timestamp overflows a signed 32-bit integer at 2,147,483,647 — which corresponds to January 19, 2038 (the Y2K38 problem). Modern systems use 64-bit integers which extend the range billions of years into the future.
What is ISO 8601?
ISO 8601 is the international standard for date and time representation: YYYY-MM-DDTHH:mm:ss.sssZ. The Z indicates UTC. Example: 2024-11-14T22:13:20.000Z. It's unambiguous, sortable alphabetically, and universally understood by APIs and databases.

เครื่องมือที่เกี่ยวข้อง