Bỏ qua đến nội dung chính
FreeOnlineTools Go
Tiếng Việt
explanation

Dấu thời gian Unix Là Gì? Giải thích Đầy đủ về Epoch Time

By FreeOnlineTools Team · Updated 2026-09-02

Quick Answer

Unix timestamp là số giây từ 1 tháng 1 1970, 00:00:00 UTC (Unix epoch). Timezone-independent và dễ so sánh. JavaScript dùng mili-giây (13 chữ số); Unix và hầu hết API dùng giây (10 chữ số). Dùng Timestamp Converter miễn phí.

Introduction

Unix timestamp (còn gọi Unix epoch time, POSIX time hoặc Unix time) là số giây từ 1 tháng 1 1970, 00:00:00 UTC —một khoảnh khắc gọi Unix epoch. Timestamp được dùng phổ biến trong hệ điều hành, cơ sở dữ liệu, log và API vì timezone-independent (luôn UTC), dễ so sánh và compact. Tuy nhiên không đọc được —1693526400 vô nghĩa không có chuyển đổi.

Step by Step

  1. Understand the Unix epoch

    The Unix epoch is January 1, 1970, 00:00:00 Coordinated Universal Time (UTC). A Unix timestamp is the count of seconds from this moment. Positive timestamps are after the epoch; negative timestamps (supported by some systems) are before it.

  2. Distinguish seconds from milliseconds

    Unix timestamps are typically in seconds (10 digits as of 2026, e.g., 1693526400). JavaScript's Date.now() and Date.getTime() return milliseconds (13 digits, e.g., 1693526400000). Always check which unit an API expects — mixing them is the most common timestamp bug.

  3. Understand timezone independence

    Unix timestamps are always UTC. They do not depend on the user's timezone. To display a timestamp in a specific timezone, convert it to a date and apply the timezone offset. This makes timestamps ideal for storage and comparison.

  4. Learn about the Year 2038 problem

    Systems using 32-bit signed integers for timestamps will overflow on January 19, 2038, 03:14:07 UTC — the 'Y2038 problem'. Systems using 64-bit integers or JavaScript numbers (64-bit floats) are unaffected. Modern systems are largely Y2038-safe, but legacy embedded systems may not be.

Examples

Timestamp for a known date

Input: 2023-09-01 00:00:00 UTC

Output: 1693526400 (seconds) or 1693526400000 (milliseconds)

The Unix epoch

Input: 1970-01-01 00:00:00 UTC

Output: 0

Y2038 problem boundary

Input: 2038-01-19 03:14:07 UTC

Output: 2147483647 (max 32-bit signed integer)

Common Problems

  • Mixing seconds and milliseconds —JavaScript uses milliseconds (Date.now()), Unix and most APIs use seconds. Divide by 1000 to convert ms to seconds; multiply by 1000 for the reverse.
  • Timezone confusion —timestamps are UTC. When displaying, convert to the user's local timezone or specify UTC. Do not apply offsets to the raw timestamp.
  • The Year 2038 problem —32-bit signed integer timestamps overflow on 2038-01-19. Use 64-bit integers or JavaScript numbers to avoid this.
  • Negative timestamps —dates before 1970-01-01 have negative timestamps. Some systems do not support them.

Tips

  • Always check whether an API expects seconds or milliseconds —this is the most common timestamp bug.
  • Use ISO 8601 strings (e.g., "2023-09-01T00:00:00Z") for human-readable timestamps in APIs; use Unix epoch for storage and computation.
  • JavaScript Date.now() returns milliseconds; divide by 1000 and floor to get seconds.
  • Use our Timestamp Converter to convert between timestamps and human-readable dates in your browser.

Related Tools

Related Guides

References