What Is a Unix Timestamp?
A Unix timestamp is the number of seconds that have elapsed since January 1, 1970, at 00:00:00 UTC — a moment known as the Unix epoch. Right now, the current Unix timestamp is somewhere around 1.77 billion and climbing by one every second. This single integer encodes a precise moment in time without any ambiguity about time zones, daylight saving, or calendar formatting. The timestamp 1704067200 means January 1, 2024, 00:00:00 UTC regardless of whether you read it in New York, Tokyo, or London. That simplicity is why Unix timestamps became the standard way to represent time in programming, databases, APIs, and log files.
The original Unix timestamp was stored as a signed 32-bit integer, giving a range from December 13, 1901, to January 19, 2038. That upper limit — 2,147,483,647 seconds past the epoch — is the Y2K38 problem, often called the Year 2038 bug. When a 32-bit signed integer overflows, it wraps to a large negative number, which translates to a date in December 1901. Systems still running 32-bit time counters will experience this overflow on January 19, 2038, at 03:14:07 UTC. Most modern operating systems and programming languages have moved to 64-bit timestamps, which pushes the overflow date about 292 billion years into the future — well past the expected lifetime of the Sun.
Many modern systems use millisecond timestamps instead of second timestamps. JavaScript's Date.now() returns milliseconds since the epoch — a 13-digit number like 1704067200000 instead of the 10-digit second-based equivalent. Java's System.currentTimeMillis() does the same. This gives you sub-second precision without floating-point math. Some systems go even further: Go's time.Now().UnixNano() returns nanoseconds, and PostgreSQL's timestamp type stores microseconds internally. When working with timestamps from different sources, always check whether you are dealing with seconds, milliseconds, or microseconds. Mixing them up — treating a millisecond timestamp as seconds or vice versa — is one of the most common time-related bugs in software.