What is a Unix Timestamp? Epoch Time Explained
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. It is a simple, universal way for computers to represent a point in time as a single number, free of time zones, calendars, and formatting. For example, the timestamp 1751731200 represents a specific second in 2025.
What is a Unix timestamp?
Instead of storing a date as text like July 5, 2026, 2:30 PM, computers often store it as a plain integer: the count of seconds since the epoch. This is called Unix time, epoch time, or POSIX time. Because it is just a number, it is compact, unambiguous, and trivial to compare or sort.
The reference point — 1970-01-01T00:00:00Z — is the Unix epoch. Every Unix timestamp is measured from that instant, so a larger number always means a later moment in time.
Why do computers use epoch time?
Representing time as a single number solves several problems at once:
- Easy math. To find the gap between two moments, you subtract one number from the other.
- Easy sorting. Ordering events by time is just ordering integers.
- No time-zone confusion. A timestamp is always in UTC, so it means the same thing everywhere.
- Compact storage. A single integer is far smaller than a formatted date string.
This is why timestamps appear everywhere in software: log files, databases, JWT token expiry, cookies, and API responses all lean on epoch time.
How Unix timestamps work
The concept is a running counter. At the epoch the value is 0. One second later it is 1, and it keeps ticking upward. So 86400 is exactly one day after the epoch (60 × 60 × 24 seconds), and today's timestamps are well over 1.7 billion.
To turn a timestamp back into a human date, software applies the target time zone and calendar rules. The number itself never changes — only its presentation does.
Seconds vs milliseconds
This trips up many developers. The traditional Unix timestamp counts seconds, but several environments count milliseconds:
| Environment | Unit | Example value |
|---|---|---|
| Unix / Linux, most APIs | Seconds | 1751731200 |
| JavaScript (Date.now) | Milliseconds | 1751731200000 |
A quick way to tell them apart: a seconds-based timestamp for a recent date has about 10 digits, while a milliseconds-based one has about 13. If a converted date lands in 1970, you probably passed milliseconds where seconds were expected, or vice versa.
Unix time vs ISO 8601
Unix timestamps are perfect for machines, but hard for humans to read. The ISO 8601 format (2026-07-05T14:30:00Z) is the readable counterpart: it is still unambiguous and sortable, but a person can understand it at a glance. Many systems store Unix time internally and display ISO 8601 to users.
The year 2038 problem
Older systems store Unix time in a signed 32-bit integer, which can only count up to 2147483647 — a value reached on January 19, 2038. After that it overflows into a negative number, echoing the Y2K bug. The fix is already widespread: modern systems use 64-bit integers, which extend the range far beyond the lifetime of the universe.
Where Unix timestamps appear
Once you know what to look for, epoch time is everywhere:
- JWT tokens — the
exp(expiry) andiat(issued-at) claims are Unix timestamps. - Databases — many systems store
created_atandupdated_atas epoch integers. - Cookies and caches — expiry times are frequently stored as Unix time.
- APIs and logs — events are timestamped in epoch seconds for easy sorting.
Getting the current timestamp in code
Fetching the current Unix time is a one-liner in most environments — just watch the unit:
// JavaScript returns milliseconds, so divide by 1000 for seconds
Math.floor(Date.now() / 1000);
import time
int(time.time()) # seconds
date +%s # seconds, on Linux and macOS
Time zones and Unix time
A key advantage of Unix time is that it has no time zone — it is always counted in UTC, so the same number means the same instant in London, New York, and Tokyo. Time zones only enter the picture when you convert a timestamp into a human-readable date, at which point you choose whether to display it in UTC or local time.
How to convert timestamps online
These free, browser-based tools convert instantly and privately:
- Timestamp Converter — convert Unix timestamps to readable dates and back, in local time or UTC.
- ISO Date Converter — convert between dates and the ISO 8601 format.
Conclusion
The Unix timestamp is one of computing's most elegant conventions: represent any instant as seconds since 1970 in UTC, and time becomes just arithmetic. Keep the seconds-versus-milliseconds distinction in mind, lean on ISO 8601 when humans need to read the value, and use a converter whenever you need to translate between a number and a date.
Try the tools
Frequently Asked Questions
What is the Unix epoch?
The Unix epoch is the reference point from which Unix time is measured: 00:00:00 UTC on January 1, 1970. A Unix timestamp is simply the number of seconds that have passed since that instant.
Why do computers count from 1970?
1970 was a round, convenient starting point chosen by the developers of the Unix operating system in the early 1970s. It has been the standard reference for computer timekeeping ever since.
Is a Unix timestamp in seconds or milliseconds?
The classic Unix timestamp is in seconds. However, many systems — notably JavaScript — measure time in milliseconds since the epoch, so those values are 1000 times larger. Always check which unit you are dealing with.
What is the year 2038 problem?
Systems that store Unix time in a signed 32-bit integer will overflow on January 19, 2038, wrapping to a negative number. Modern systems use 64-bit integers, which pushes the limit billions of years into the future.
Do Unix timestamps have a time zone?
A Unix timestamp is always measured in UTC, so it represents the same instant everywhere. Time zones only come into play when you convert the timestamp into a human-readable local date.
CodeUtilityKit Team builds free, privacy-first developer tools that run entirely in your browser. Every guide is written and reviewed by developers who use these tools daily.