Unix Timestamp Converter

See the current epoch time live and convert any timestamp to a date or back.

—Current Unix time (seconds)
—Milliseconds

Timestamp → date

Date → timestamp

How to convert a Unix timestamp

  1. Paste a timestamp in seconds, milliseconds, microseconds or nanoseconds. The unit is detected automatically.
  2. Read the date in UTC, in your local time zone, in ISO 8601 and as relative time ("3 days ago").
  3. To go the other way, pick a date and time below to get its timestamp in seconds and milliseconds.

Getting the current timestamp in code

  • JavaScript: Math.floor(Date.now() / 1000)
  • Python: int(time.time())
  • PHP: time()
  • SQL (PostgreSQL): extract(epoch from now())
  • Shell: date +%s

Converting between cities instead? Use the Time Zone Converter. Inspecting token expiry? The JWT Decoder converts exp and iat claims for you.

Timestamps and time zones

A Unix timestamp describes a single instant that is the same everywhere: 1700000000 is 22:13:20 UTC on 14 November 2023, which is 17:13:20 in New York and 03:43:20 the next day in Delhi. Time zones only come into play when you display the timestamp to a person. That is why storing timestamps in UTC and converting only for display avoids most date bugs.

Negative timestamps

Dates before 1 January 1970 are negative numbers. For example, -86400 is 31 December 1969. Most modern languages handle negative timestamps correctly, but some older databases and spreadsheets do not.

Timestamps in databases and spreadsheets

  • MySQL: FROM_UNIXTIME(1700000000) and UNIX_TIMESTAMP()
  • PostgreSQL: to_timestamp(1700000000)
  • SQLite: datetime(1700000000, 'unixepoch')
  • Excel / Google Sheets: =A1/86400 + DATE(1970,1,1), then format the cell as a date (the result is in UTC).

ISO 8601

ISO 8601 strings such as 2023-11-14T22:13:20Z are the most readable way to exchange dates between systems. The trailing Z means UTC. Unlike formats such as 11/14/2023, ISO dates are unambiguous worldwide and sort correctly as text.

Why computers use Unix time

Storing time as a single number makes it easy to compare, sort and calculate with dates: subtracting two timestamps gives the number of seconds between them, regardless of time zones, daylight saving changes or calendar quirks. That is why Unix time is used in file systems, databases, log files, APIs, JSON Web Tokens and cookies. The trade-off is that it is unreadable for humans, which is exactly the problem this converter solves.

Converting timestamps from logs

Server and application logs often record events as epoch seconds or milliseconds. Paste a value to see when an event happened in your own time zone, which is essential when investigating an incident across systems in different regions. If a timestamp converts to a date in 1970, it was probably in seconds but read as milliseconds, or the value was zero or missing. If it lands tens of thousands of years in the future, it was in milliseconds but read as seconds; this converter detects the unit automatically to avoid exactly that mix-up.

Frequently asked questions

What is a Unix timestamp?

It is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970 (the Unix epoch), not counting leap seconds. It is the same everywhere in the world, regardless of time zone.

Seconds or milliseconds?

Unix and most databases use seconds (10 digits today). JavaScript, Java and many APIs use milliseconds (13 digits). This converter detects the unit automatically.

What is the year 2038 problem?

Systems that store timestamps as signed 32-bit integers overflow on 19 January 2038 at 03:14:07 UTC. Modern systems use 64-bit values and are not affected.

Last updated · By the Toolbenchly team · How we build and test our tools