WebTool

The Complete Guide to Unix Timestamps: Seconds vs. Milliseconds, Time Zones, and the Year 2038 Problem

WebTool Team · Published 2026-09-04 · Timestamp / Unix / Backend

A Unix timestamp is the number of seconds elapsed since 1970-01-01 00:00:00 UTC (the epoch). It has no time zone of its own — the same instant has the exact same timestamp everywhere on Earth. For quick conversions, use our timestamp tool, which auto-detects seconds vs. milliseconds and lets you switch time zones.

Telling seconds from milliseconds

Count the digits: a seconds-level timestamp in the current era has 10 digits (e.g. 1700000000), while milliseconds have 13 (e.g. 1700000000000). A quick rule of thumb: 10 digits or fewer means seconds, 11 or more means milliseconds.

Context Common unit
Unix/Linux systems, most backend APIs Seconds
JavaScript Date.now(), Java System.currentTimeMillis() Milliseconds

Mixing the two up is a classic production incident: treat milliseconds as seconds and your dates land 50,000 years in the future.

What time zones really are

Timestamps don't have time zones — the zone only matters at the "format for display" step. 1700000000 displays as 2023-11-15 06:13:20 in Beijing (UTC+8) and 2023-11-14 22:13:20 in UTC — the same instant. When debugging a "time is off by 8 hours" issue, first figure out whether the stored value is wrong or the display zone is.

The Year 2038 problem

Seconds-level timestamps stored in a signed 32-bit integer will overflow and wrap back to 1901 at 2038-01-19 03:14:07 UTC. Modern 64-bit systems are unaffected, but embedded devices and legacy database schemas (MySQL's TIMESTAMP type, for example, only goes up to 2038) still need care — use BIGINT or DATETIME in new designs.

Getting the current timestamp in every language

Language Seconds Milliseconds
JavaScript Math.floor(Date.now()/1000) Date.now()
Python int(time.time()) int(time.time()*1000)
Go time.Now().Unix() time.Now().UnixMilli()
Java Instant.now().getEpochSecond() System.currentTimeMillis()
SQL (MySQL) UNIX_TIMESTAMP() UNIX_TIMESTAMP(NOW(3))*1000

Last updated: 2026-09-04