เวลา/ตัวเลข
Unix Timestamp ↔ วันที่
แปลงเวลา Unix เป็นวันที่และย้อนกลับ พร้อมรองรับเขตเวลาใดก็ได้ (IANA)
Unix time (epoch time) is the number of seconds elapsed since January 1, 1970, 00:00:00 UTC. It's the most common way to store time in databases, APIs, and logs, since it's just a single integer with no tie to a specific timezone or date format.
How to use it
- Timestamp → date: paste a number of seconds (or milliseconds) and the tool shows the date and time in your chosen timezone.
- Date → timestamp: pick a date and time to get the matching Unix timestamp.
- The "now" button fills in the current moment instantly — handy for testing an API or grabbing a fresh value.
Common uses
- Reading a created_at or expires_at field from an API response that arrived as a raw number.
- Checking whether a token or session has expired, given an expiry field in seconds since the epoch.
- Building a timestamp for test data or a date filter in a database query.
Things to keep in mind
Mixing up seconds and milliseconds is the most common mistake: JavaScript's Date.now() returns milliseconds, while most Unix APIs use seconds — a factor of 1000 off.
Unix time itself has no timezone — it's always UTC; a timezone is only applied when displaying the date to a person.
บทความเกี่ยวกับเครื่องมือนี้: Unix time: เหตุใดคอมพิวเตอร์จึงนับเวลาตั้งแต่ปี 1970
คำถามที่พบบ่อย
Unix timestamp คืออะไร?
คือจำนวนวินาทีที่ผ่านไปนับตั้งแต่วันที่ 1 มกราคม 1970 เวลา 00:00:00 UTC (ยุค Unix) ตัวเลขนี้ไม่ผูกกับเขตเวลาใด ๆ — เขตเวลาจะถูกนำมาใช้ก็ต่อเมื่อแสดงวันที่ให้คนดูเท่านั้น
วินาทีกับมิลลิวินาทีต่างกันอย่างไร?
JavaScript และ API บางตัว (เช่น Date.now()) คืนค่า timestamp เป็นมิลลิวินาที ในขณะที่เวลา Unix แบบดั้งเดิมเป็นวินาที การสับสนหน่วยจะให้วันที่เป็นปี 1970 หรือที่ไหนสักแห่งในอนาคตอันไกล — เลือกหน่วยที่ถูกต้องในฟิลด์ "หน่วย"
เวลา Unix นับรวมวินาทีอธิกสุรทินหรือไม่?
ไม่ แต่ละวันในเวลา Unix มีค่าเท่ากับ 86400 วินาทีเสมอ วินาทีอธิกสุรทินจะถูกละเว้น ระบบที่ต้องการซิงค์กับ UTC ทางดาราศาสตร์อย่างแม่นยำจะจัดการวินาทีอธิกสุรทินด้วยกลไกแยกต่างหากนอกเหนือจาก Unix timestamp มาตรฐาน
Unix timestamp เป็นค่าติดลบได้หรือไม่?
ได้ ค่าติดลบสอดคล้องกับวันที่ก่อน 1 มกราคม 1970 ระบบสมัยใหม่ส่วนใหญ่จัดการค่าเหล่านี้ได้อย่างถูกต้อง แม้ว่า API หรือไลบรารีรุ่นเก่าบางตัวอาจไม่รองรับ
ปัญหาปี 2038 คืออะไร?
ในระบบที่เก็บ timestamp เป็นจำนวนเต็ม 32 บิตแบบมีเครื่องหมาย ตัวนับวินาทีจะล้นในวันที่ 19 มกราคม 2038 ระบบ 64 บิตสมัยใหม่ไม่มีปัญหานี้