What Is a Unix Timestamp and How Do You Convert It to a Date?

By 4 min read

A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, a moment called the Unix epoch. For example, 1794321000 is 10 November 2026 at 14:30:00 UTC. Computers use it because one number is easy to store, sort and compare, and it means the same moment everywhere in the world.

How Unix time works

  • It counts up by one every second. 0 is the epoch itself and 86400 is exactly one day later. Negative numbers are dates before 1970, so -86400 is 31 December 1969.
  • It is always in UTC. A timestamp has no time zone. The zone only matters when you show the date to a person.
  • It ignores leap seconds. Every day counts as exactly 86,400 seconds.

So converting a timestamp to a date takes two steps: turn the number into a UTC date and time, then shift it into the time zone you want to display.

Seconds or milliseconds?

The most common mistake is mixing up the two units. Count the digits:

Digits Unit Example Where you see it
10 Seconds 1794321000 Linux and macOS commands, Python, PHP
13 Milliseconds 1794321000000 JavaScript, Java

Every date from September 2001 to November 2286 has a 10-digit timestamp in seconds and a 13-digit one in milliseconds. If you read a millisecond value as seconds, you get a date more than 50,000 years in the future. If you read seconds as milliseconds, you land on 21 January 1970.

How to convert a Unix timestamp to a date

In your browser

Paste the number into the epoch converter. It reads 13-digit values as milliseconds and 10-digit values as seconds, and shows the date in UTC, in ISO 8601 format and in your device's local time.

It works the other way too. Type a date such as 2026-11-10 14:30 UTC and it returns 1794321000 seconds and 1794321000000 milliseconds. A date typed without a time zone is read as UTC.

If you want to choose the unit yourself, the Unix timestamp converter has a menu for seconds or milliseconds. The Unix milliseconds to date tool takes 13-digit values only.

In code

JavaScript counts in milliseconds, so multiply a timestamp in seconds by 1000:

new Date(1794321000 * 1000).toISOString(); // "2026-11-10T14:30:00.000Z"
Math.floor(Date.now() / 1000);             // the current time in seconds

Python counts in seconds:

from datetime import datetime, timezone
print(datetime.fromtimestamp(1794321000, tz=timezone.utc))  # 2026-11-10 14:30:00+00:00

On the command line, date +%s prints the current timestamp. To turn a timestamp back into a date, use date -u -d @1794321000 on Linux or date -u -r 1794321000 on macOS.

In Excel or Google Sheets

Spreadsheets count days, not seconds. Divide the timestamp by 86,400 and add the epoch date, with the timestamp in cell A1:

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

Then format the cell as a date and time. The result is in UTC.

Show the time in your own time zone

Converters give you UTC first. To show local time, you add the time zone's offset, which can change during the year with daylight saving time. The UTC to local time converter takes a UTC date, a time and an IANA time zone name such as Asia/Karachi or America/New_York, and applies the right offset for that date.

For 10 November 2026 at 14:30 UTC, it gives:

  • 19:30 in Karachi (GMT+5)
  • 09:30 in New York (GMT-5)

Convert a date to a timestamp

To store a date as a timestamp, write it in UTC first. The ISO date to Unix timestamp tool converts a calendar date at midnight UTC, so 10 November 2026 becomes 1794268800.

Need a time of day as well? Add it in seconds. 14 hours and 30 minutes is 14 × 3,600 + 30 × 60 = 52,200 seconds, and 1794268800 + 52200 = 1794321000, the same timestamp as at the start of this guide. Or type the full date and time into the epoch converter and let it do the sum.

The year 2038 problem

Older systems store Unix time as a signed 32-bit integer. The largest value it can hold is 2147483647, which is 19 January 2038 at 03:14:07 UTC. One second later the number overflows and wraps around to the smallest value, -2147483648, which is 13 December 1901 at 20:45:52 UTC.

Most modern operating systems and programming languages now store time as a 64-bit number, which pushes the limit about 292 billion years away. Old databases, file formats and embedded devices can still use 32-bit time, so it is worth checking any system that has to handle dates after 2038.

Quick checks before you trust a conversion

Count the digits first. For any date between September 2001 and November 2286, ten digits means seconds and thirteen means milliseconds.

Look for a time zone marker. An ISO date ending in Z, such as 2026-11-10T14:30:00Z, is UTC. A date with no Z and no offset could be in any zone.

Convert back. Turn your date into a timestamp again with the epoch converter. If you get the number you started with, the conversion is right.

Questions and answers

Is a Unix timestamp always in UTC?

Yes. It counts seconds from the epoch at midnight UTC on 1 January 1970, so the same number is the same moment everywhere. Time zones only matter when you display it.

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

Count the digits. For dates from September 2001 to November 2286, a timestamp in seconds has 10 digits and one in milliseconds has 13.

What date is Unix timestamp 0?

Timestamp 0 is 1 January 1970 at 00:00:00 UTC, the Unix epoch. Negative timestamps are dates before it.

More from the blog