What Is a Unix Timestamp?

A Unix timestamp is a number that represents a moment by counting time from a shared starting point, rather than spelling it out as a local calendar date.

Unix Timestamp: Unix epoch, Starting instant; Elapsed count, Seconds or ms; Readable date, Choose a zone.

The basic idea

Computers need reliable ways to record when something happened. A written date like 04/05/2026 can mean 4 May or April 5, depending on local convention. A clock time such as 9:00 is also incomplete unless we know where it was observed. A timestamp avoids much of this ambiguity by representing one instant as a count from a defined origin.

The usual Unix timestamp counts seconds since 00:00:00 UTC on 1 January 1970. That starting instant is called the Unix epoch. For example, the timestamp 1700000000 corresponds to 14 November 2023 at 22:13:20 UTC. The value identifies the moment, but does not itself say how a clock in London, Kolkata or New York should display it.

Seconds and milliseconds

Unix timestamps are commonly expressed in seconds, but many programming environments use milliseconds. JavaScript's Date.now() returns milliseconds from the epoch. A seconds value is often around ten digits today, while a milliseconds value is often around thirteen digits. Digit count is a useful clue, not a universal rule: check the API or data specification whenever possible.

If a milliseconds number is mistakenly read as seconds, the result lands far in the future. If a seconds number is read as milliseconds, it appears close to January 1970. When exchanging timestamps, include the unit in the field name or documentation, such as created_at_seconds or created_at_ms.

Why developers use timestamps

Numbers are convenient for comparing instants and measuring elapsed time. Subtract an earlier timestamp from a later one and the result is a duration in the same unit. Databases and event logs often store a normalized instant, then format it for a person's locale only when displaying it. This separates the fact that an event happened from the way a clock presents that fact.

A timestamp can also be negative. Negative Unix timestamps represent moments before the epoch. Not all systems support the same date range, so very old or far-future values may be limited by a language, database or platform.

Timestamp does not mean time zone

The timestamp points to one moment worldwide. A time zone is needed to turn that moment into a local wall-clock reading. The same timestamp might be early morning in one place and the previous evening somewhere else. For a future appointment that must remain at a particular local hour, also retain the intended named zone, such as Asia/Kolkata. A timestamp alone preserves the instant, not the social intention behind an appointment.

A note about leap seconds

Ordinary Unix timestamps do not give leap seconds their own distinct count in the way a direct count of every physical second might. Most software uses a continuous, simplified timeline for timestamps. This is appropriate for common applications, but scientific systems that need traceability to physical time use more specialized time scales and conventions.

Common ways timestamps are stored

A timestamp might be stored as an integer number of seconds, an integer number of milliseconds, or a decimal value with a fractional part. Some databases store a date-time type instead of exposing a numeric count. The label “timestamp” alone does not tell you the unit, precision, epoch or time scale. API documentation should state these details, and field names such as created_at_ms can make a unit explicit.

Converting between units may involve rounding or truncation. If a millisecond value is divided by 1,000 and stored as a whole number of seconds, the smaller fraction is lost. That may be acceptable for a log display but not for measuring closely spaced events. Keep the highest precision the application actually needs, and avoid implying more accuracy than the source clock provides.

How timestamps behave around dates

A timestamp identifies a moment, so its local calendar date can change with the selected zone. The same value may be 16 October in one location and 15 October in another. This is not a contradiction. It is the expected result of converting one instant into local wall-clock time.

For appointments that have not happened yet, a timestamp alone can also lose the user's intent. “Meet at 09:00 every Monday in London” should be modeled with a local recurrence and the Europe/London zone. If the region changes its civil-time rules, the future UTC instants can be recalculated while the local appointment remains at 09:00.

Integer limits and the Year 2038 issue

Some older systems used signed 32-bit integers to count seconds from the Unix epoch. Such a value has a finite maximum and reaches its limit in January 2038. Newer systems often use 64-bit integers or other date representations, so the issue does not apply to every platform. When working with legacy databases, embedded devices or old file formats, confirm the stored type and test dates near its documented boundary.

Do not “fix” an out-of-range value by changing its unit without checking the source. A seconds-versus-milliseconds mistake can move a date by thousands of years. If the timestamp is not documented, compare it against known events and inspect the producing system.

When to keep a date instead

Not every temporal value is an instant. A birthday, an all-day holiday or an invoice due date may be a calendar date with no time zone. Turning it into a timestamp can introduce an unnecessary midnight and shift the date when it is displayed elsewhere. Store a date-only value for a date-only meaning, and use timestamps for exact moments.

To convert seconds or milliseconds into a readable date, try the Unix timestamp converter. For the origin behind the count, read What Is the Unix Epoch?