What Is a Unix Timestamp? How to Read and Convert Epoch Time

By Jasveer Raj · Updated 2026-11-28

Quick answer

A Unix timestamp is the number of seconds that have passed since 1 January 1970 at 00:00:00 UTC, known as the Unix epoch. It gives a single number that identifies a moment in time, independent of time zones.

Examples

  • 0 is 1 January 1970, 00:00:00 UTC.
  • 1700000000 is 14 November 2023, 22:13:20 UTC.

Unix timestamp digits: 10, 13, 16 or 19

Count the digits to find the unit. The values below all describe the same moment, 14 November 2023 at 22:13:20 UTC.

DigitsUnitExampleTo get seconds
10Seconds1700000000Use as it is
13Milliseconds1700000000000Divide by 1,000
16Microseconds1700000000000000Divide by 1,000,000
19Nanoseconds1700000000000000000Divide by 1,000,000,000

This applies to current dates. Much older or much later moments have a different number of digits.

Unix timestamp in nanoseconds

  • Python: time.time_ns()
  • Go: time.Now().UnixNano()
  • Linux terminal: date +%s%N (GNU date)
  • JavaScript: BigInt(Date.now()) * 1000000n, which has millisecond precision only

A nanosecond timestamp is larger than JavaScript's biggest safe integer, so keep it as a BigInt or a string. The unit describes the format, and the real precision depends on the system clock.

Useful reference timestamps

MomentUnix timestamp (seconds)Date and time
Unix epoch01970-01-01 00:00:00 UTC
1 billion seconds10000000002001-09-09 01:46:40 UTC
Start of 202015778368002020-01-01 00:00:00 UTC
Start of 202417040672002024-01-01 00:00:00 UTC
1.7 billion seconds17000000002023-11-14 22:13:20 UTC
Start of 202517356896002025-01-01 00:00:00 UTC
Start of 202617672256002026-01-01 00:00:00 UTC
Start of 202717987616002027-01-01 00:00:00 UTC
2 billion seconds20000000002033-05-18 03:33:20 UTC
32-bit limit (2038 problem)21474836472038-01-19 03:14:07 UTC

Seconds in common time periods

PeriodSeconds
1 minute60
1 hour3,600
1 day86,400
1 week604,800
30 days2,592,000
1 year (365 days)31,536,000

How to get the current Unix timestamp

  • JavaScript: Math.floor(Date.now() / 1000)
  • Python: int(time.time()) after import time
  • PHP: time()
  • MySQL: SELECT UNIX_TIMESTAMP();
  • PostgreSQL: SELECT EXTRACT(EPOCH FROM NOW());
  • Linux or macOS terminal: date +%s

Convert a Unix timestamp to a date in code

  • JavaScript: new Date(ts * 1000).toISOString()
  • Python: datetime.fromtimestamp(ts, tz=timezone.utc)
  • PHP: date('c', $ts)
  • MySQL: SELECT FROM_UNIXTIME(ts);
  • PostgreSQL: SELECT to_timestamp(ts);
  • Linux terminal: date -d @ts (on macOS use date -r ts)

More ways to get the current epoch time

  • Java: Instant.now().getEpochSecond()
  • Go: time.Now().Unix()
  • C#: DateTimeOffset.UtcNow.ToUnixTimeSeconds()
  • Ruby: Time.now.to_i
  • JavaScript in milliseconds: Date.now()

Epoch time, POSIX time and Unix time

These names all mean the same thing: a count of seconds since the epoch, 1 January 1970 UTC. POSIX time is the name used in the standard that defines it.

Seconds or milliseconds?

Traditional Unix time counts seconds and has 10 digits for dates today. JavaScript and many APIs use milliseconds, which have 13 digits. If a converted date lands in 1970 or in the far future, you probably mixed up the two.

Converting by hand

Divide the timestamp by 86,400 to get days since the epoch, since a day has 86,400 seconds. Then add that many days to 1 January 1970. Software does this for you and accounts for leap years.

Why developers use Unix time

  • It is compact and easy to compare and sort.
  • It avoids time-zone and daylight-saving confusion because it is always UTC.
  • It is supported by virtually every programming language and database.

Best practices

  1. Store and transmit time in UTC, and convert to local time only for display.
  2. Be explicit about seconds versus milliseconds in field names.
  3. Prefer 64-bit integers for timestamps.
  4. Use ISO 8601 text, such as 2023-11-14T22:13:20Z, when humans need to read the data.

The year 2038 problem

Systems that store Unix time in a signed 32-bit integer will overflow at 2147483647, which is 19 January 2038 at 03:14:07 UTC. Most modern systems use 64-bit values and are not affected, but old embedded systems may be.

FAQ

Does Unix time count leap seconds?

No. Unix time ignores leap seconds, treating every day as exactly 86,400 seconds.

What is the current Unix timestamp?

It is the number of seconds since 1 January 1970 UTC right now. The Unix timestamp converter shows it live and updates every second.

Can a timestamp be negative?

Yes. Negative values represent moments before 1 January 1970.

Convert any timestamp with the free converter below.

Try the calculator

Esc