What Is Unix Epoch Time? Seconds, Milliseconds and Time Zones

Learn what a Unix timestamp counts, how to tell seconds from milliseconds, why time zones cause off-by-hours bugs, and how to convert epoch time anywhere.

Updated September 29, 2026 5 min read

Use the free Unix Timestamp ConverterConvert epoch time to dates and dates to timestamps

Log files, databases, APIs and tokens are full of numbers like 1700000000 or 1735689600000. They are Unix timestamps: dates and times stored as a single count. They are compact, easy to compare and free of time-zone ambiguity, which is why systems love them. People, on the other hand, cannot read them, and converting them carelessly produces dates that are off by hours or thrown decades into the future.

This guide explains what a Unix timestamp counts, how to tell seconds from milliseconds at a glance, where time zones come into play, and how to convert timestamps in a browser, in code, on the command line and in a spreadsheet.

What the number counts

A Unix timestamp is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, a moment known as the Unix epoch. So:

  • 0 is 1970-01-01T00:00:00Z;
  • 1700000000 is 2023-11-14T22:13:20Z;
  • 1735689600 is 2025-01-01T00:00:00Z;
  • negative numbers are dates before 1970.

Two properties make timestamps useful. First, a timestamp is the same everywhere on Earth at the same instant; it has no time zone. Second, subtracting two timestamps gives the elapsed time in seconds, so durations and sorting are trivial.

Unix time also ignores leap seconds: every day is treated as exactly 86,400 seconds. For almost all business uses this does not matter.

Seconds, milliseconds, micro and nano

Different systems count in different units, and mixing them up is the single most common timestamp bug.

Digits (for current dates) Unit Typical source
10 seconds Unix tools, PHP, Python time.time() (as a float), JWT claims
13 milliseconds JavaScript Date.now(), Java, many JSON APIs
16 microseconds Some databases and Python libraries
19 nanoseconds Go, some logging and tracing systems

If a date comes out in January 1970, you treated seconds as milliseconds, so the date landed a few weeks after the epoch. If the date is tens of thousands of years in the future, you treated milliseconds as seconds. Counting the digits usually settles it.

Where time zones come in

The timestamp itself has no time zone; the conversion to a human-readable date does. The same instant 1700000000 is 22:13 on 14 November in London (UTC), 17:13 in New York and 03:43 on 15 November in Mumbai.

Off-by-hours bugs almost always come from the conversion step:

  • A date string without an offset, such as 2024-08-15 10:30, is interpreted in some time zone, often the server's. The resulting timestamp depends on where the code runs.
  • Code that formats timestamps in local time on a server set to UTC gives different output than on a developer's laptop.
  • Daylight saving time means a local wall-clock time can occur twice, or not at all, on transition days.

The safe habits are to store and transmit timestamps or ISO 8601 strings with an explicit offset (2024-08-15T10:30:00+05:30 or ...Z), and to convert to local time only for display.

Convert timestamps with our tool

The Unix Timestamp Converter runs in your browser and works in both directions.

  1. Open the Unix Timestamp Converter. The top panel shows the Current Unix timestamp (seconds), updating every second, with milliseconds and ISO 8601 beneath it. Use Pause to freeze it and the copy button to copy it.
  2. Under Timestamp to date, paste a timestamp or press Now. The tool detects whether it is in seconds, milliseconds, microseconds or nanoseconds, and shows it as local time (with your time zone name), UTC, ISO 8601, a relative time such as "3 days ago", and the value in seconds and milliseconds. Each row has a copy button.
  3. Under Date to timestamp, pick a date and time. By default it is read in your time zone; switch on Treat as UTC to read it as UTC. You get seconds, milliseconds, ISO 8601 and relative time.
  4. For many values, use Batch convert: paste one timestamp or date per line (mixed units and ISO date strings are fine), and download the result as a CSV with columns for detected type, seconds, milliseconds, ISO 8601 UTC and local time. Invalid lines are marked rather than dropped.

Batch mode is handy for a column of timestamps copied from a log or database export.

Converting in code and on the command line

// JavaScript works in milliseconds
Math.floor(Date.now() / 1000);                 // current Unix seconds
new Date(1700000000 * 1000).toISOString();     // "2023-11-14T22:13:20.000Z"
Math.floor(Date.UTC(2025, 0, 1) / 1000);       // 1735689600 (months are 0-based)
import time, datetime
int(time.time())
datetime.datetime.fromtimestamp(1700000000, tz=datetime.timezone.utc)
date +%s                    # current timestamp (Linux and macOS)
date -u -d @1700000000      # GNU date (Linux)
date -u -r 1700000000       # BSD date (macOS)
[DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
[DateTimeOffset]::FromUnixTimeSeconds(1700000000)

Always pass an explicit time zone (UTC) when converting in code. Functions that silently use the machine's local zone are a frequent source of bugs that only appear in production.

In Excel and Google Sheets

Spreadsheets store dates as day counts, so divide by the number of seconds in a day and add the epoch date:

=A2/86400 + DATE(1970,1,1)

Format the cell as a date and time. For milliseconds, divide by 86,400,000 instead. The result is in UTC; add or subtract hours/24 to shift it to a local zone. To go the other way, use =(A2 - DATE(1970,1,1)) * 86400.

The year 2038 problem

Systems that store Unix time in a signed 32-bit integer can count only up to 2,147,483,647, which is 03:14:07 UTC on 19 January 2038. One second later the value overflows and wraps to a date in 1901. Modern operating systems and languages use 64-bit time, but old embedded devices, file formats and database columns defined as 32-bit integers can still be affected. If you design a schema today, use a 64-bit integer or a native timestamp type.

Tips

  • Name fields with their unit, such as created_at_ms, so nobody has to guess.
  • JWT exp and iat claims are in seconds; the JWT Decoder converts them for you.
  • For the time between two dates, the Date Difference Calculator is simpler than subtracting timestamps by hand, and the Time Zone Converter helps when you are scheduling across regions.

Frequently asked questions

What is the Unix epoch?

It is the reference moment 00:00:00 UTC on 1 January 1970. Unix timestamps count seconds from that instant.

How do I know if a timestamp is in seconds or milliseconds?

Count the digits. For current dates, 10 digits means seconds and 13 means milliseconds. Our converter detects the unit automatically.

Does a Unix timestamp have a time zone?

No. It represents the same instant everywhere. A time zone only matters when you turn it into a calendar date and clock time.

Why is my converted date off by several hours?

The conversion used a different time zone from the one you expected, usually local time instead of UTC or the reverse. Convert with an explicit zone.

What happens in 2038?

Systems storing Unix time as a signed 32-bit number overflow on 19 January 2038. Systems using 64-bit time, which includes modern operating systems and JavaScript, are not affected.

Try it now: Unix Timestamp Converter

Loading tool…