What is a Unix Timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — the "Unix epoch" — not counting leap seconds. It is the universal way computers store a moment in time as a single number, independent of time zones. This calculator converts a value in milliseconds into the standard Unix timestamp in seconds, and also shows the equivalent minutes, hours, and days since the epoch.
How to Use It
Enter a time value in milliseconds. To get the current Unix timestamp ("epoch now"), supply the present time in milliseconds; the default value is provided as an example. The calculator divides by 1,000 and rounds down to give whole seconds, the format expected by almost every API, database, and programming language.
The Formula Explained
The core conversion is $$\text{Epoch} = \left\lfloor \dfrac{\text{Time (ms)}}{1000} \right\rfloor$$ Milliseconds offer thousandth-of-a-second precision, but the classic Unix timestamp is measured in whole seconds, so we take the floor (drop the fractional part). From there, dividing the epoch by 60, 3,600, and 86,400 yields minutes, hours, and days respectively.
$$\begin{aligned} \text{Minutes} &= \left\lfloor \tfrac{\text{Epoch}}{60} \right\rfloor \\ \text{Hours} &= \left\lfloor \tfrac{\text{Epoch}}{3600} \right\rfloor \\ \text{Days} &= \left\lfloor \tfrac{\text{Epoch}}{86400} \right\rfloor \end{aligned}$$
Worked Example
Suppose the current time is 1,700,000,000,000 milliseconds. Dividing by 1,000 gives 1,700,000,000 seconds — that is the Unix timestamp.
$$\left\lfloor \frac{1{,}700{,}000{,}000{,}000}{1000} \right\rfloor = 1{,}700{,}000{,}000 \text{ s}$$Dividing 1,700,000,000 by 86,400 and flooring gives 19,675 days since January 1, 1970, which corresponds to mid-November 2023.
$$\left\lfloor \frac{1{,}700{,}000{,}000}{86{,}400} \right\rfloor = 19{,}675 \text{ days}$$Epoch Time Unit Conversion Table
Unix (POSIX) epoch time counts whole seconds elapsed since 1970-01-01 00:00:00 UTC. Because every unit below is defined as a fixed number of seconds, converting an epoch value into other units is a single division. The calculator itself first converts milliseconds to seconds with \(\text{Epoch} = \lfloor \text{ms} / 1000 \rfloor\), then applies the divisors in the last column.
| Unit | Exact size in seconds | Size in milliseconds | Divisor applied to an epoch value in seconds |
|---|---|---|---|
| 1 millisecond | 0.001 s | 1 ms | × 1000 (to go from seconds to ms) |
| 1 second | 1 s | 1,000 ms | ÷ 1 |
| 1 minute | 60 s | 60,000 ms | ÷ 60 |
| 1 hour | 3,600 s | 3,600,000 ms | ÷ 3,600 |
| 1 day | 86,400 s | 86,400,000 ms | ÷ 86,400 |
| 1 week | 604,800 s | 604,800,000 ms | ÷ 604,800 |
| 1 common (non-leap) year = 365 days | 31,536,000 s | 31,536,000,000 ms | ÷ 31,536,000 |
| 1 Julian year = 365.25 days | 31,557,600 s | 31,557,600,000 ms | ÷ 31,557,600 |
Two cautions about the last two rows. Months and calendar years are not fixed-length quantities: a month runs 28–31 days and a calendar year is 365 or 366 days, so dividing an epoch value by a "year" constant gives an approximate elapsed duration, never a calendar date. Only the day, hour, minute and second rows are exact in POSIX time. The Julian year (365.25 days) is an astronomical convention used for averaging long spans; the 365-day common year is the simpler approximation. To obtain an actual date you must run the epoch value through a calendar algorithm rather than a division.
Note also that POSIX time defines every day as exactly 86,400 seconds, which is why the table has no leap-second entry — see the interpretation section below.
FAQ
Why seconds and not milliseconds? The original Unix standard uses seconds. JavaScript's Date.now() returns milliseconds, so you often divide by 1,000.
Does it handle time zones? No — Unix time is always UTC. The same instant has the same timestamp everywhere on Earth.
What is the year 2038 problem? Systems storing the timestamp in a signed 32-bit integer overflow on January 19, 2038. Modern 64-bit systems avoid this.