Toolman

Unix Timestamp Converter

Convert between Unix time and human-readable dates. Seconds, milliseconds, microseconds and nanoseconds are detected automatically.

Current Unix time


What is a Unix timestamp?

Unix time (also called epoch time or POSIX time) counts the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, ignoring leap seconds. Because it is a single integer in a single time zone, it is the standard way to store and compare instants in databases, log files and APIs.

Seconds, milliseconds and beyond

UnitDigits todayTypical source
Seconds10Unix tools, PHP time(), Python time.time(), most REST APIs
Milliseconds13JavaScript Date.now(), Java System.currentTimeMillis()
Microseconds16PostgreSQL internals, some tracing systems
Nanoseconds19Go time.UnixNano(), Prometheus and OpenTelemetry

A common bug is mixing the two most popular units: passing milliseconds where seconds are expected puts the date around the year 56,000, and passing seconds where milliseconds are expected lands you in January 1970.

The year 2038 problem

Systems that store Unix time in a signed 32-bit integer overflow at 03:14:07 UTC on 19 January 2038, wrapping around to 1901. Modern platforms use 64-bit time, but the issue still appears in old embedded firmware, legacy database columns and file formats.

Converting in code

JavaScript  new Date(ts * 1000).toISOString()
            Math.floor(Date.now() / 1000)
Python      datetime.fromtimestamp(ts, timezone.utc)
            int(datetime.now(timezone.utc).timestamp())
SQL         to_timestamp(ts)              -- PostgreSQL
            FROM_UNIXTIME(ts)             -- MySQL
Go          time.Unix(ts, 0).UTC()
Bash        date -u -d @$ts

Frequently asked questions

How do I know if a number is seconds or milliseconds?

Count the digits. A current timestamp in seconds has 10 digits; in milliseconds it has 13. This tool detects the unit automatically and shows which one it used.

Why is epoch time based on 1 January 1970?

It was chosen when Unix was developed in the early 1970s as a convenient recent reference point that fit comfortably in the integer sizes of the day.

Does Unix time include leap seconds?

No. Unix time deliberately pretends every day has exactly 86,400 seconds, which keeps arithmetic simple but means it drifts from true astronomical time by the number of leap seconds inserted so far.

Can a timestamp be negative?

Yes. Negative values represent instants before 1970 — for example -86400 is 31 December 1969.

What time zone is a Unix timestamp in?

None, and that is the point. It always denotes an instant in UTC; time zones only matter when you format it for a human.

Related tools