Epoch Time Calculator: Convert Unix Timestamps
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
An epoch time calculator converts between Unix timestamps (the number of seconds since January 1, 1970, UTC) and human-readable dates and times. You enter a timestamp to get the corresponding date and time, or enter a date and time to get the timestamp. The calculator below does both conversions instantly, using your device’s local time zone unless you specify UTC.
Formula
The core formula is simple: Unix timestamp = (target date/time – January 1, 1970 00:00:00 UTC) in seconds. In the calculator above, we use the JavaScript Date object’s internal representation (milliseconds since the epoch) and convert it to seconds by dividing by 1000. For the inverse, we multiply the timestamp by 1000 and pass it to the Date object to get a human-readable string.
- Timestamp (ts) – an integer representing seconds since 1970-01-01 00:00:00 UTC. Negative values represent dates before 1970.
- Date and time (dt) – a string in the format
YYYY-MM-DD HH:MM:SS, interpreted as local time by the browser. - Output – the timestamp in seconds, and the equivalent UTC and local date/time strings.
Worked Example
Using the default timestamp 1700000000:
- Convert to milliseconds: 1,700,000,000 × 1000 = 1,700,000,000,000 ms.
- Feed into the Date object:
new Date(1700000000000). - The Date object returns the UTC string:
2023-11-14 22:13:20(which is what the calculator shows). - For the local time, the browser adjusts based on your time zone (e.g., UTC+5 gives 2023-11-15 03:13:20).
So the calculator’s output for the default is 2023-11-14 22:13:20 UTC (or your local equivalent).
Why 1970? The Unix Epoch Explained
The Unix epoch (January 1, 1970) was chosen by Ken Thompson and Dennis Ritchie when developing Unix at Bell Labs. It was a convenient, round number at the time, and it allowed the system clock to be stored as a single 32-bit integer counting seconds. That 32-bit limit meant the maximum timestamp was 2,147,483,647, which corresponds to January 19, 2038 – the famous Year 2038 problem. Many modern systems use 64-bit integers, extending the range billions of years, but the epoch remains the same.
Why not 1960 or 1980? The 1970 date was simply the current date when the system was being designed, and it stuck. Other systems use different epochs (e.g., Apple’s Cocoa uses 2001-01-01, and Windows uses 1601-01-01), but Unix’s is the most widespread.
How to Use an Epoch Time Calculator
Using the calculator above is straightforward, but here are common use cases:
- Convert a timestamp from a log file – paste the number into the timestamp field and read the UTC time.
- Get the current timestamp – many APIs return timestamps; you can check your system’s current time and compute the difference.
- Convert a date to a timestamp – for scheduling or scripting, enter a future date and copy the output.
- Check time zone effects – note that the same timestamp gives different local times depending on your location.
Most online calculators also offer a “current timestampâ€� button, but here you can just enter the current time manually or use your system’s clock.
Common Mistakes and Pitfalls
- Mixing milliseconds and seconds – many programming languages (like JavaScript) use milliseconds, so a timestamp like 1700000000000 is 1000 times larger than 1700000000. Always check the units.
- Ignoring time zones – a timestamp is absolute; it doesn’t change with your location. But when you convert it to a date, you must specify UTC or local. The calculator shows both to avoid confusion.
- Using 32-bit limits – if you’re working with older systems, timestamps after 2038 may overflow. For most modern applications, 64-bit is fine.
- Leap seconds – Unix time ignores leap seconds (it treats each day as exactly 86,400 seconds). This is intentional for simplicity but can cause tiny discrepancies with actual astronomical time.
Alternatives and Related Tools
If you need more than simple conversion, consider:
- Command-line tools – on Linux/macOS,
date -d @1700000000converts a timestamp; on Windows, PowerShell can do it with[DateTimeOffset]::FromUnixTimeSeconds(1700000000). - Programming languages – Python’s
datetime.fromtimestamp(), JavaScript’snew Date(), and PHP’sdate()all handle conversion natively. - Spreadsheet functions – Excel and Google Sheets have functions like
=(A1/86400)+DATE(1970,1,1)for conversion. - Other epoch calculators – many websites offer similar tools, but this one also explains the math and includes time zone handling.
Limitations of the Formula
The conversion formula assumes a proleptic Gregorian calendar (extending the current calendar backward) and ignores leap seconds. It also assumes your device’s clock is correct and that you input the date in the correct format. For dates before 1970, negative timestamps work, but some systems may not support them. The calculator also cannot handle dates beyond the year 275760 (the JavaScript Date limit), but that’s far beyond practical use.
Frequently Asked Questions
What is the current Unix timestamp?
It changes every second. As of the time you read this, you can get it by running date +%s on Linux/macOS or [DateTimeOffset]::UtcNow.ToUnixTimeSeconds() in PowerShell. Online calculators often show it live, but this one doesn’t auto-refresh; you can compute it by entering the current UTC time.
How do I convert a timestamp to a date in Excel?
In Excel, divide the timestamp by 86400 (seconds per day) and add the date 1970-01-01. The formula is =A1/86400 + DATE(1970,1,1), where A1 contains the timestamp. Format the cell as a date/time.
What is the difference between Unix timestamp and milliseconds?
A Unix timestamp is typically in seconds, but many systems (like JavaScript) use milliseconds. To convert seconds to milliseconds, multiply by 1000. For example, 1700000000 seconds = 1700000000000 ms. Always verify which unit your system uses.
Why do some timestamps have negative numbers?
Negative timestamps represent dates before January 1, 1970. For example, -86400 corresponds to December 31, 1969. This is valid in most systems, but some older software may not handle negative values correctly.
Does the calculator handle time zones correctly?
Yes. The timestamp is absolute, and the calculator shows both UTC and your local time. The local time is based on your browser’s time zone setting, which you can change in your operating system.
What happens after 2038?
If a system uses 32-bit signed integers for timestamps, it will overflow on January 19, 2038. Most modern systems use 64-bit integers, which will not overflow for billions of years. This calculator uses 64-bit numbers, so it’s safe.
Related
Formula used
in ts | Timestamp | seconds | 1700000000 | 0 in dt | Date and time (YYYY-MM-DD HH:MM:SS) | - | 2023-11-14 22:13:20 | 0 out epoch | Unix timestamp (seconds) | - | (dt - 0) / 1 | 0 out utc | UTC date and time | - | (ts + 0) / 1 | time out local | Local date and time | - | (ts + 0) / 1 | time
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.