What Is a Unix Timestamp? Seconds, Milliseconds, and the Year 2038 Problem

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. The timestamp 1700000000 means 1,700,000,000 seconds after that moment, which is 14 November 2023 at 22:13:20 UTC. It is how most computers store and compare times: one plain number, no timezones, no date formats to argue about.

You meet Unix timestamps everywhere once you know what to look for: in API responses, database columns, log files, JWT expiry claims, and file modification times. This guide explains what the number means, the seconds-versus-milliseconds mix-up that bites every developer at least once, and the Year 2038 problem waiting at the end of the counter.

Programming code on a computer screen

What a Unix Timestamp Is (Seconds Since 1 January 1970)

The Unix epoch — midnight UTC on 1 January 1970 — is an arbitrary starting line. Engineers working on early Unix in the early 1970s needed a fixed reference point to count time from, and the start of 1970 was close at hand. The choice was pragmatic rather than symbolic, and it stuck: Unix time is now the most widely used time system in computing.

Every second since that moment adds 1 to the count. A few landmarks, all checked against the clock:

Timestamp Moment (UTC)
0 1 January 1970, 00:00:00 — the epoch itself
86400 2 January 1970, 00:00:00 — one day later (86,400 seconds in a day)
1000000000 9 September 2001, 01:46:40 — the billion-second mark
1700000000 14 November 2023, 22:13:20
2147483647 19 January 2038, 03:14:07 — the largest 32-bit signed value

Timestamps before the epoch are negative: -1 is one second before midnight on 1 January 1970. And Unix time ignores leap seconds by design — every day is exactly 86,400 seconds, so the count drifts slightly from astronomical time over the decades. For almost all software, that trade-off is worth it: date arithmetic becomes plain subtraction. The gap between two timestamps is just the number of seconds between the two moments, with no calendar logic involved.

That simplicity is the whole point. “14 November 2023, 22:13:20 UTC” needs a format, a timezone, and a parser. 1700000000 needs none of those. It sorts correctly, compares correctly, and takes 4 or 8 bytes to store. Whenever a system needs to record when something happened, a timestamp is the obvious choice.

Seconds vs Milliseconds: The Bug That Bites Every Developer

There are two Unix timestamps in common use, and they differ by a factor of a thousand. A seconds timestamp is 10 digits long (as of 2026): 1700000000. A milliseconds timestamp is 13 digits: 1700000000000. Both describe the exact same moment — 14 November 2023 at 22:13:20 UTC.

The split comes from the languages. Python’s time.time() returns seconds (as a float, so 1700000000.0). JavaScript’s Date.now() returns milliseconds. Java, Go, and most databases work in seconds or nanoseconds depending on the API. So a frontend written in JavaScript and a backend written in Python will disagree about what “now” looks like by three digits, and the bug that follows is always the same: a date that lands in the wrong century.

Feed a milliseconds timestamp to code expecting seconds, and you get a date about 54,000 years in the future. Feed a seconds timestamp to code expecting milliseconds, and you get a date in January 1970. Both are easy to spot once you know the pattern, and both are fixed the same way: divide by 1,000 to go from milliseconds to seconds, multiply by 1,000 to go the other way. A quick sanity check is the digit count — 10 digits means seconds, 13 means milliseconds. (Some systems use microseconds, 16 digits, or nanoseconds, 19 digits; the same rule of thumb applies.)

Where does the confusion usually strike? JWT expiry claims (exp) are seconds — a token that expires “in an hour” has an exp about 3,600 above the current seconds timestamp. If your code compares it against a milliseconds “now”, every token looks expired 1,000 times too early, or never expired at all, depending on which direction the mix-up runs.

Close-up of a clock showing the time

Timestamps Have No Timezone (and Why That Confuses People)

A Unix timestamp names one instant, and that instant is the same everywhere on Earth. 1700000000 is 22:13:20 in London, 17:13:20 in New York, and 03:13:20 the next morning in Tokyo. The timestamp does not change; only the clock reading does. That is the feature, not a bug: storing a single timezone-free number means two systems in different countries can agree on exactly when something happened without negotiating formats.

The confusion comes at display time. When you convert a timestamp to a date, you must pick a timezone, and tools pick one for you — usually your computer’s local zone. So the same timestamp shows different clock readings on different machines, and people conclude the timestamp itself is “in” some timezone. It is not. Think of the timestamp as the instant, and the date string as a translation of that instant into one local dialect.

The practical rule follows from that: store and send timestamps (or ISO 8601 strings with an explicit offset), and convert to local time only at the moment you show it to a person. Never store “14 November 2023, 22:13” as bare text without a timezone — nobody reading it later can tell which 22:13 it was. If your team works across zones, that discipline matters twice as much; the roundup of the best tools for remote teams working across time zones covers the scheduling side of the same problem.

How to Convert a Timestamp to a Date (and Back)

In Python, the datetime module does both directions. Use timezone.utc to be explicit about which zone you mean:

from datetime import datetime, timezone

# Timestamp to date (UTC)
dt = datetime.fromtimestamp(1700000000, tz=timezone.utc)
print(dt)  # 2023-11-14 22:13:20+00:00

# Date to timestamp
print(int(dt.timestamp()))  # 1700000000

In JavaScript, the Date constructor takes milliseconds, so multiply seconds by 1,000 first:

const date = new Date(1700000000 * 1000);
console.log(date.toISOString());  // "2023-11-14T22:13:20.000Z"

// Back to a seconds timestamp
console.log(Math.floor(Date.now() / 1000));

On the command line, the date utility reads timestamps with @:

date -d @1700000000 -u   # Tue Nov 14 22:13:20 UTC 2023
date +%s                 # current time as a seconds timestamp

For a quick one-off conversion without writing code, the free Unix timestamp converter turns a timestamp into a readable date in your timezone (and back again) in the browser. And if you need the gap between two dates in days, weeks, or working days rather than raw seconds, the date difference calculator does that arithmetic for you.

Lines of code on a dark screen

The Year 2038 Problem, Explained Simply

Unix time was originally stored in a signed 32-bit integer — a number that can hold values from −2,147,483,648 to 2,147,483,647. The largest value, 2,147,483,647 seconds after the epoch, falls on 19 January 2038 at 03:14:07 UTC. One second later, the counter runs out of room.

What happens then depends on the system, but the classic failure is a wraparound: the counter overflows to its smallest value, −2,147,483,648, which the system reads as 13 December 1901 at 20:45:52 UTC. Time jumps backwards by about 136 years. Anything that compares dates, sorts by time, or checks expiry breaks in confusing ways — a certificate that looks 136 years expired, a scheduled job that thinks its run time is a century away.

How worried should you be? For modern systems, not very. Most current operating systems, languages, and databases already store time in 64-bit integers, which will not overflow for roughly 292 billion years. The risk sits with old, rarely updated systems: embedded devices, industrial controllers, and legacy software still running 32-bit time. The MySQL TIMESTAMP type is a well-known example — on older MySQL versions it uses 32-bit storage and tops out at the same 2038 date.

The fix is unglamorous but complete: store timestamps in 64-bit integers. If you maintain a system with 32-bit time anywhere in it — a database column, a file format, an old binary — that is worth checking long before 2038, because the failure mode is not a polite error message. It is a clock that silently claims to be 1901.

Convert Any Timestamp Online

If you have a timestamp in front of you right now and just want to know what date it is, paste it into the free Unix timestamp converter. It handles seconds and milliseconds, shows the date in your local timezone and in UTC, and converts dates back to timestamps. The digit-count check from earlier — 10 digits for seconds, 13 for milliseconds — will tell you which one you are holding before you even paste it in.

Analogue wall clock

Frequently Asked Questions

What is a Unix timestamp?

The number of seconds since 00:00:00 UTC on 1 January 1970, the Unix epoch. For example, 1700000000 is 14 November 2023 at 22:13:20 UTC. It is also called epoch time or POSIX time.

What is the difference between a 10-digit and a 13-digit timestamp?

The 10-digit value counts seconds since the epoch; the 13-digit value counts milliseconds. They describe the same moment — 1700000000 seconds equals 1700000000000 milliseconds. JavaScript’s Date.now() returns milliseconds; Python’s time.time() returns seconds.

What is the Year 2038 problem?

Systems that store Unix time in a signed 32-bit integer run out of room at 03:14:07 UTC on 19 January 2038, when the counter reaches 2,147,483,647. One second later it overflows to a negative value, read as December 1901. Modern 64-bit systems are unaffected.

Does a Unix timestamp include the timezone?

No. A timestamp names one instant, the same everywhere. The timezone only enters when you convert it to a readable date: 1700000000 is 22:13:20 in London and 17:13:20 in New York on the same day.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top