Skip to content
DevPenh

Unix Timestamp Converter

Convert Unix epoch timestamps to UTC and local dates, or ISO 8601 dates to timestamps. Seconds, milliseconds, microseconds and nanoseconds are detected automatically.

Current Unix time (seconds)

—

Milliseconds

—

UTC

—

Timestamp to date

Unit

Date to timestamp

If no offset is given, treat as

Seconds or milliseconds?

A Unix timestamp counts time since 1970-01-01 00:00:00 UTC. Different systems use different units, and mixing them up is the most common timestamp bug: a seconds value read as milliseconds lands in January 1970, and a milliseconds value read as seconds lands tens of thousands of years in the future.

UnitDigits todayTypical sources
Seconds10Unix date +%s, PHP time(), Python int(time.time()), JWT claims
Milliseconds13JavaScript Date.now(), Java System.currentTimeMillis()
Microseconds16PostgreSQL internals, some tracing systems
Nanoseconds19Go time.Now().UnixNano(), OpenTelemetry, InfluxDB

Auto-detect picks the unit from the number of digits, which is reliable for dates between roughly 1973 and 5138. For older dates, or if the guess is wrong, choose the unit explicitly. JavaScript dates have millisecond precision, so microsecond and nanosecond input is truncated to milliseconds (the integer part is handled exactly, without floating-point rounding).

UTC and local time

A timestamp identifies one instant; it has no time zone. Time zones only matter when you display it. This tool shows the instant in UTC and in your device's time zone, labelled with the zone name and offset.

When converting a date to a timestamp, an explicit offset (Z, +07:00, -0530) always wins. If you leave it out, choose whether the date should be read as UTC or as local time. Only ISO 8601-style input is accepted, because other formats such as 03/04/2024 are ambiguous and parsed differently by different browsers.

Getting timestamps in code

// JavaScript
Math.floor(Date.now() / 1000)          // seconds
new Date(1700000000 * 1000).toISOString() // "2023-11-14T22:13:20.000Z"

# Python
import time, datetime
int(time.time())
datetime.datetime.fromtimestamp(1700000000, tz=datetime.timezone.utc)

# Shell (GNU date; on macOS use: date -u -r 1700000000)
date +%s
date -u -d @1700000000

Edge cases

  • Negative timestamps represent dates before 1970 and are supported.
  • Unix time ignores leap seconds; every day is exactly 86,400 seconds. A seconds field of 60 is therefore rejected.
  • The "Relative" value ("3 hours ago") is approximate: months are treated as 30 days and years as 365 days.
  • Signed 32-bit seconds overflow on 2038-01-19 at 03:14:07 UTC (2147483647). Systems still storing time in 32-bit integers will fail after that point.

More background: Unix timestamps explained.