What Is a Unix Timestamp? A Complete Guide for Developers

Learn what a Unix timestamp is, why it starts in 1970, the difference between seconds and milliseconds, and how to convert Unix timestamps to readable dates.

A Unix timestamp is a simple way to represent a specific point in time as a number.

Instead of storing a date like:

2026-08-24 14:30:00

a system can represent the same moment as:

1787553000

Unix timestamps are widely used in APIs, databases, logs, programming languages, and distributed systems because they provide a consistent, machine-friendly way to work with time.

In this guide, you’ll learn what a Unix timestamp is, why Unix time starts in 1970, the difference between seconds and milliseconds, and how to convert timestamps into readable dates.

What Is a Unix Timestamp?

A Unix timestamp represents the number of seconds that have elapsed since a specific starting point known as the Unix Epoch.

The Unix Epoch begins at:

January 1, 1970, 00:00:00 UTC

For example:

0 = January 1, 1970, 00:00:00 UTC

As time passes, the timestamp increases.

For example:

1 = January 1, 1970, 00:00:01 UTC
60 = January 1, 1970, 00:01:00 UTC
3600 = January 1, 1970, 01:00:00 UTC

Unix timestamps are also commonly called:

  • Unix time
  • Epoch time
  • POSIX time
  • Epoch timestamp

Why Does Unix Time Start on January 1, 1970?

The starting point of Unix time is called the Unix Epoch.

Instead of storing multiple values such as:

Year
Month
Day
Hour
Minute
Second

a system can store a single number representing the amount of time that has passed since a fixed starting point.

Unix chose:

January 1, 1970, 00:00:00 UTC

as that reference point.

This makes time calculations simple.

For example, if one event happened at:

1787553000

and another happened at:

1787556600

you can calculate the difference:

1787556600 - 1787553000 = 3600

The difference is:

3600 seconds = 1 hour

This simple numerical representation is one of the main reasons Unix timestamps are still widely used today.

Unix Timestamp Examples

Unix Timestamp in Seconds

The traditional Unix timestamp format uses seconds.

For example:

1787553000

This is a 10-digit Unix timestamp.

Most Unix systems and many APIs use timestamps in seconds.

In JavaScript:

Math.floor(Date.now() / 1000)

returns the current Unix timestamp in seconds.

Unix Timestamp in Milliseconds

Some programming languages and APIs use milliseconds instead.

For example:

1787553000000

This is typically a 13-digit timestamp.

The difference is:

1 second = 1,000 milliseconds

For example:

Unix timestamp in seconds:

1787553000

becomes:

Unix timestamp in milliseconds:

1787553000000

In JavaScript:

Date.now()

returns the current time in milliseconds.

This difference between seconds and milliseconds is one of the most common sources of timestamp errors.

Unix Timestamp vs. Date and Time

A Unix timestamp and a human-readable date represent the same concept: a specific moment in time.

The difference is how that information is stored or displayed.

A human-readable date might look like:

August 24, 2026, 14:30:00

A Unix timestamp might look like:

1787553000

The timestamp is easier for computers to store and compare, while the date is easier for humans to read.

This is why many systems store timestamps internally but convert them into formatted dates when displaying information to users.

How to Convert a Unix Timestamp

There are two common types of timestamp conversion.

Convert Unix Timestamp to Date

You can convert a Unix timestamp into a readable date and time.

For example:

1787553000

can be converted into a date and time in UTC or your local timezone.

The exact displayed time may differ depending on the timezone you use.

A timestamp represents one specific moment, but that moment can be displayed differently around the world.

For example:

UTC:
2026-08-24 06:30:00

Tokyo:
2026-08-24 15:30:00

New York:
2026-08-24 02:30:00

All of these represent the same moment in time.

Convert Date to Unix Timestamp

You can also convert a readable date into a Unix timestamp.

For example:

2026-08-24 14:30:00 UTC

can be converted into the number of seconds that have passed since the Unix Epoch.

This is useful when:

  • Working with APIs
  • Storing timestamps in databases
  • Creating scheduled tasks
  • Debugging logs
  • Comparing events
  • Working with backend systems

If you need to convert timestamps quickly, you can use an online Unix timestamp converter or a browser extension such as Unix Timestamp Converter & Epoch Pro.

Unix Timestamp in Different Programming Languages

JavaScript

JavaScript’s Date.now() returns the current timestamp in milliseconds.

const timestamp = Date.now();

console.log(timestamp);

To get the timestamp in seconds:

const timestamp = Math.floor(Date.now() / 1000);

console.log(timestamp);

To convert a Unix timestamp in seconds into a JavaScript Date:

const timestamp = 1787553000;

const date = new Date(timestamp * 1000);

console.log(date);

The multiplication by 1000 is necessary because JavaScript expects timestamps in milliseconds.

Python

Python provides the time and datetime modules for working with Unix timestamps.

Get the current timestamp:

import time

timestamp = time.time()

print(timestamp)

Convert a Unix timestamp into a readable date:

from datetime import datetime

timestamp = 1787553000

date = datetime.fromtimestamp(timestamp)

print(date)

For UTC:

from datetime import datetime, timezone

timestamp = 1787553000

date = datetime.fromtimestamp(timestamp, timezone.utc)

print(date)

PHP

You can get the current Unix timestamp with:

$timestamp = time();

echo $timestamp;

Convert a timestamp into a formatted date:

$timestamp = 1787553000;

echo date("Y-m-d H:i:s", $timestamp);

Java

Modern Java provides the Instant class for working with Unix timestamps.

import java.time.Instant;

long timestamp = 1787553000L;

Instant instant = Instant.ofEpochSecond(timestamp);

System.out.println(instant);

For milliseconds:

Instant instant = Instant.ofEpochMilli(1787553000000L);

Common Unix Timestamp Problems

Seconds vs. Milliseconds

The most common problem is confusing timestamps in seconds with timestamps in milliseconds.

For example:

1787553000

is in seconds.

But:

1787553000000

is in milliseconds.

If you pass a seconds-based timestamp directly into a JavaScript Date object, JavaScript will interpret it as milliseconds and return a date close to January 1970.

Incorrect:

new Date(1787553000);

Correct:

new Date(1787553000 * 1000);

A useful rule of thumb is:

10 digits → usually seconds
13 digits → usually milliseconds

However, this is only a practical guideline. Always check the documentation of the API or system you are working with.

UTC vs. Local Time

Unix timestamps represent a specific moment independent of how that moment is displayed.

When converting a timestamp into a readable date, the result may be displayed in UTC or your local timezone.

This can cause confusion when debugging systems.

For example:

UTC:
2026-08-24 06:30:00

Local time:
2026-08-24 15:30:00

The timestamp is still the same.

Only the displayed timezone has changed.

When debugging timestamps, it is often useful to check both:

  • UTC time
  • Local time

Negative Unix Timestamps

Unix timestamps can also be negative.

A negative timestamp represents a moment before January 1, 1970.

For example:

-1

represents:

December 31, 1969, 23:59:59 UTC

Support for dates before 1970 can vary depending on the programming language, operating system, or library.

When Should You Use a Unix Timestamp?

Unix timestamps are useful whenever you need to store or compare a specific point in time.

Common use cases include:

  • API responses
  • Database records
  • Application logs
  • Authentication tokens
  • Cache expiration
  • Scheduled jobs
  • Analytics events
  • Server monitoring
  • Distributed systems

Because timestamps are numerical, they are easy to compare.

For example:

if timestamp_a > timestamp_b

then timestamp_a represents a later point in time.

This makes Unix timestamps especially useful in backend development and data processing.

Unix Timestamp FAQ

What is the Unix timestamp right now?

The current Unix timestamp is the number of seconds that have passed since January 1, 1970, 00:00:00 UTC.

You can get the current timestamp using programming languages, command-line tools, or a Unix timestamp converter.

Is Unix timestamp always in seconds?

No.

Traditional Unix timestamps are measured in seconds, but many systems use milliseconds.

For example:

10 digits → usually seconds
13 digits → usually milliseconds

Some systems may also use microseconds or nanoseconds.

Why does JavaScript use milliseconds?

JavaScript’s Date API represents timestamps in milliseconds.

That is why a Unix timestamp in seconds usually needs to be multiplied by 1000 before creating a JavaScript Date.

What is the difference between Unix time and Epoch time?

In most cases, the terms Unix time, Unix timestamp, and Epoch time are used interchangeably.

They usually refer to the number of seconds that have passed since:

January 1, 1970, 00:00:00 UTC

However, some systems may use the term “epoch” more generally to describe a custom reference point.

Can a Unix timestamp be negative?

Yes.

Negative Unix timestamps represent dates before January 1, 1970.

For example:

-1 = December 31, 1969, 23:59:59 UTC

What happens when Unix timestamps reach their limit?

Some older systems store Unix timestamps as signed 32-bit integers.

This creates the well-known Year 2038 problem, where the maximum value is reached in January 2038.

Modern systems commonly use 64-bit timestamps, which support a much larger range of dates.

Convert Unix Timestamps Quickly

Unix timestamps are simple once you understand the basic idea:

Unix timestamp = time elapsed since January 1, 1970, 00:00:00 UTC

The most important thing to watch for is the unit:

10 digits → usually seconds
13 digits → usually milliseconds

You should also pay attention to whether the converted date is displayed in UTC or your local timezone.

If you regularly work with timestamps in APIs, logs, databases, or browser-based development, Unix Timestamp Converter & Epoch Pro can help you quickly convert common Unix timestamps, automatically detect 10-digit and 13-digit formats, and view timestamps in both UTC and local time.