ClockAura

What Is Unix Time (Epoch Time)?

Unix time is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, a moment called the Unix epoch. It ignores leap seconds and time zones, so the same instant has the same Unix timestamp everywhere in the world.

Free tool: Convert a timestamp to a date →

Why computers count time this way

Dates are awkward for software. Months have different lengths, time zones shift, and daylight saving time moves the clocks twice a year. A single growing number avoids all of that. To find out how long passed between two events, subtract one timestamp from the other. To sort events, sort the numbers.

The early Unix operating system at Bell Labs settled on 1 January 1970 as its starting point, and the convention spread to almost every system since: Linux, macOS, Android, databases, web servers and most programming languages.

Reading a timestamp: 10 digits or 13?

A Unix timestamp in seconds currently has 10 digits, for example 1791504000. Many systems, including JavaScript and Java, use milliseconds instead, which adds three digits: 1791504000000. If a timestamp turns into a date in the year 58,000 or in January 1970, it is almost certainly in the wrong unit.

TimestampMoment (UTC)
01 January 1970, 00:00:00
1,000,000,0009 September 2001, 01:46:40
1,234,567,89013 February 2009, 23:31:30
1,700,000,00014 November 2023, 22:13:20
2,000,000,00018 May 2033, 03:33:20
2,147,483,64719 January 2038, 03:14:07

Negative timestamps are valid and mean dates before 1970. −86,400 is 31 December 1969.

Getting the current Unix time

  • Linux or macOS terminal: date +%s
  • JavaScript: Math.floor(Date.now() / 1000) for seconds, or Date.now() for milliseconds
  • Python: import time; int(time.time())
  • PHP: time()
  • SQL (PostgreSQL): SELECT EXTRACT(EPOCH FROM now());

Or open the Unix timestamp converter, which shows the live timestamp and converts in both directions in your own time zone.

Time zones and Unix time

A Unix timestamp has no time zone. It marks one instant, and that instant is the same everywhere. The time zone only matters when you turn it into a date for a person to read. 1800000000 is 15 January 2027 at 08:00 UTC, which is 03:00 in New York and 13:30 in India, all at the same moment.

This is why developers store timestamps (or UTC dates) and convert to local time only for display. If you need to compare clocks between cities, the time zone converter does that, and our guide to GMT vs UTC explains the reference everything is measured from.

Leap seconds: the one quirk

Unix time pretends every day is exactly 86,400 seconds. When a leap second was added to UTC, Unix clocks either repeated a second or smeared the extra second across several hours. The practical effect is that subtracting two timestamps can be out by the number of leap seconds between them, at most 27. For almost any everyday purpose that does not matter, and no leap second has been added since 2016.

Converting a timestamp by hand

You rarely need to, but it shows how simple the format is. Take 1,800,000,000. Divide by 86,400 to get days since 1970: 20,833 whole days, with 28,800 seconds left over. 28,800 seconds is 8 hours, so the time is 08:00 UTC. Counting 20,833 days forward from 1 January 1970, allowing for leap years, lands on 15 January 2027.

Going the other way is the same in reverse: count the days from 1 January 1970 to your date, multiply by 86,400 and add the seconds since midnight UTC. In practice, a converter or a single line of code is faster and avoids leap-year slips.

Common Unix time mistakes

  • Mixing seconds and milliseconds. Passing a 10-digit value to JavaScript's Date gives a date in January 1970; passing 13 digits to a function expecting seconds gives a date tens of thousands of years away.
  • Treating local time as UTC. If you build a timestamp from a local date without stating the time zone, it can be off by your UTC offset, and by an extra hour around daylight saving changes.
  • Storing timestamps as text. Strings sort and compare differently from numbers. Store them in an integer or a proper date-time column.
  • Assuming every day is the same in local time. A day is always 86,400 Unix seconds, but a local calendar day can be 23 or 25 hours long when the clocks change.
  • Using 32-bit fields for future dates. Anything after January 2038 needs 64-bit storage.

When debugging, paste the suspect value into the Unix timestamp converter. If the date looks wrong by a round number of hours, it is a time zone problem; if it is wrong by decades or millennia, it is a seconds-versus-milliseconds problem.

The year 2038 problem

Older systems store Unix time as a signed 32-bit integer, whose largest value is 2,147,483,647. That number is reached at 03:14:07 UTC on 19 January 2038. One second later, a 32-bit counter overflows to a large negative number and the date jumps back to December 1901.

Modern operating systems and languages use 64-bit time, which will not overflow for about 292 billion years, so most computers and phones are already fine. The risk is in old embedded devices, file formats and databases that still use 32-bit fields. If you maintain software that stores dates far in the future, such as 30-year loans or certificates, it is worth checking now.

Frequently asked questions

What is Unix time?

Unix time is the number of seconds since 00:00:00 UTC on 1 January 1970, ignoring leap seconds. It is used by almost every computer system to store dates.

What is the Unix epoch?

The Unix epoch is the starting point of Unix time: midnight UTC at the start of 1 January 1970, which has the timestamp 0.

Is a Unix timestamp in seconds or milliseconds?

Classic Unix time is in seconds (10 digits today). JavaScript, Java and many APIs use milliseconds (13 digits). Divide a 13-digit value by 1,000 to get seconds.

Does Unix time depend on time zone?

No. A Unix timestamp is the same everywhere for the same instant. Time zones only apply when converting it into a readable local date.

What happens in 2038?

Systems that store Unix time as a signed 32-bit number overflow at 03:14:07 UTC on 19 January 2038. Systems using 64-bit time, which includes most modern ones, are not affected.

What is the current Unix timestamp?

It changes every second. In late 2026 it is a 10-digit number starting with 179 or 180. The Unix timestamp converter shows the live value.

What is Unix time 0?

Unix time 0 is 00:00:00 UTC on Thursday, 1 January 1970.

Related guides

See all guides.