TheFileTools

How to convert a Unix timestamp to a date

Read a Unix timestamp from a log or database as a real date in UTC and your time zone, or turn a date into a timestamp.

Logs, databases and APIs often store time as a single number such as 1700000000. It is the count of seconds since 1 January 1970, 00:00 UTC, and it is impossible to read at a glance.

Steps

  1. Open Unix timestamp converter. With the field empty it shows the current time.
  2. Type a timestamp, or a date.
  3. Read the five rows: Unix seconds, Unix milliseconds, ISO 8601, UTC and Your time zone. Each row has its own Copy button.

Worked example

Enter 1700000000. The ISO 8601 row shows 2023-11-14T22:13:20.000Z and the UTC row shows Tue, 14 Nov 2023 22:13:20 GMT. The last row shows the same moment on your own clock, so in a zone one hour ahead of UTC it reads 23:13:20.

Seconds, milliseconds or microseconds

There is no unit switch. The tool decides by the size of the number:

  • below 100,000,000,000 it is read as seconds (10 digits for present-day dates),
  • below 100,000,000,000,000 it is read as milliseconds (13 digits), which is what JavaScript and Java produce,
  • anything larger is read as microseconds (16 digits).

So 1700000000 and 1700000000000 give the same date. The rule misreads only millisecond values from the first years after 1970, which is rarely a problem. Negative numbers work and mean dates before 1970.

From a date to a timestamp

Type a date and the first two rows give the timestamp. 2024-01-01T00:00:00Z returns 1704067200. Pay attention to the time zone:

  • A Z or an offset such as +02:00 at the end fixes the zone explicitly.
  • A date alone, such as 2024-01-01, is read as midnight UTC.
  • A date with a time but no zone, such as 2024-01-01T09:00, is read in your computer's time zone.

Other spellings are passed to the browser's date parser and may behave differently between browsers, so the ISO form is the reliable one.

Related tools

The exp and iat fields of a token are Unix seconds. JWT decoder converts them for you. To count the days between two calendar dates, use Days between dates.