Skip to content
DocsAll
教程

Timestamp Conversion: Unix/ISO/Local Time Interconversion Explained

Timi Tian · Published on May 8, 2026 · Updated on July 12, 2026
TimestampUnix TimeDate Conversion

What is a Timestamp

A timestamp is a numeric value representing a specific moment. The most common is the Unix timestamp—the number of seconds (or milliseconds) that have passed since 1970-01-01 00:00:00 UTC. For example, 1720780800 corresponds to 2024-07-12 12:00:00 UTC. Timestamps are everywhere in programming, logs, databases, and APIs.

Why Conversion is Needed

  • Reading logs: Logs are full of timestamps that are hard to read by eye, so you convert them to readable time
  • Debugging APIs: An endpoint returns a timestamp and you need to verify it's correct
  • Crossing time zones: Converting a UTC timestamp to local time for display
  • Databases: The stored value is a timestamp, but display needs formatting

Common Time Formats

Unix Timestamp

  • Seconds: 10 digits (e.g., 1720780800)
  • Milliseconds: 13 digits (e.g., 1720780800000; common in JS/Java)

ISO 8601

Like 2024-07-12T12:00:00Z—an international standard format, commonly used in APIs. The trailing Z means UTC.

Local Time

Like 2024-07-12 20:00:00, with a time zone offset; varies by region.

DocsAll Timestamp Converter

Use the Timestamp Converter to convert in one click:

  1. Open the Timestamp Tool
  2. Enter a timestamp to automatically show readable time; or enter a time to get a timestamp
  3. Toggle between seconds and milliseconds
  4. Copy the result

Conversion Examples

Timestamp (seconds) UTC Time Beijing Time (UTC+8)
0 1970-01-01 00:00 1970-01-01 08:00
1720780800 2024-07-12 12:00 2024-07-12 20:00

Common Pitfalls

Seconds vs. Milliseconds

JS's Date.now() returns milliseconds (13 digits), while Python's time.time() returns seconds (10 digits). Mixing them up means a 1000x difference, so confirm the unit before converting.

Time Zones

The same timestamp displays differently in different time zones. Beijing time is 8 hours ahead of UTC; 1720780800 is 12:00 noon in UTC and 8 PM in Beijing. A common practice is to store UTC on the backend and display by the user's time zone on the frontend.

The Year 2038 Problem

A 32-bit Unix timestamp overflows on 2038-01-19. Modern systems mostly use 64 bits and are unaffected, but older embedded systems need attention.

Negative Timestamps

Times before 1970 are represented as negative numbers. Some tools don't support them, so be careful when converting dates before 1969.

Practical Tips

  • Store UTC timestamps uniformly on the backend and convert to the local time zone on the frontend as needed
  • When analyzing logs, batch-convert timestamps to readable time with a tool—it's a hundred times faster than doing it in your head
  • When debugging an endpoint, first confirm whether it returns seconds or milliseconds

Timestamp conversion is a high-frequency daily task for developers. Bookmark the tool and open it whenever you need it.

T
Timi Tian 创始人 / 全栈工程师

DocsAll 创始人,10 年全栈开发经验,专注浏览器端文档处理技术与隐私保护架构。前新加坡科技公司技术负责人。