Unix Time Converter: How It Works & How to Use It
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.
A Unix time converter takes a Unix timestamp (the number of seconds since January 1, 1970, UTC) and turns it into a human-readable date and time, or does the reverse. You enter either the timestamp or the date, and the converter gives you the corresponding value in the other format, usually with your local timezone applied.
Formula
The core formula is: Unix timestamp = (date in UTC) – (January 1, 1970, 00:00:00 UTC). In practice, the timestamp is the number of seconds that have elapsed since the Unix epoch (1970-01-01T00:00:00Z), ignoring leap seconds. To convert a date to a timestamp, you calculate the difference between that date and the epoch. To convert a timestamp to a date, you add that many seconds to the epoch.
Let t be the Unix timestamp in seconds, and D be the corresponding UTC date and time. Then:
- D = 1970-01-01T00:00:00Z + t seconds
- t = D – 1970-01-01T00:00:00Z (in seconds)
All variables are in UTC; local timezone conversion is a separate step that the converter applies for display.
Worked Example
Using the default values from the converter above:
- Take the Unix timestamp 1,700,000,000 seconds.
- Add that to the epoch: 1970-01-01T00:00:00Z + 1,700,000,000 seconds.
- Compute the date: 1,700,000,000 seconds = 19,675.9259 days. Adding to the epoch gives 2023-11-14T22:13:20Z (as verified by standard conversion).
- The converter shows the date as 2023-11-14 (UTC), ignoring the time part for simplicity.
- For the reverse, entering 2023-11-14 as a date gives the timestamp for that date at midnight UTC, which is 1,699,977,600 seconds. The converter shows the original timestamp as the output.
So the default timestamp 1,700,000,000 corresponds to 2023-11-14T22:13:20Z, and the default date 2023-11-14 corresponds to 1,699,977,600 seconds.
Background: Why 1970?
The Unix epoch was chosen by early Unix developers because it was a round, convenient date at the time. January 1, 1970, was already used in many system calendars, and using a single fixed point simplifies time calculations. The timestamp counts seconds since that moment, which makes arithmetic easy: adding 86,400 seconds always advances one day (ignoring leap seconds). This system became standard with the POSIX specification and is now used by Linux, macOS, Android, and countless programming languages and databases.
One common misconception is that the Unix epoch is the same as the start of the Gregorian calendar or the birth of a particular operating system. It is not—it is simply a fixed reference point. Another misconception is that the timestamp accounts for leap seconds; it does not. Unix time ignores leap seconds, so the actual UTC time can differ by up to a second from the timestamp-based time.
How to Choose a Unix Time Converter
When selecting a converter, consider what you need it for:
- Precision: Do you need seconds, milliseconds, or microseconds? Some systems use milliseconds (e.g., JavaScript
Date.now()returns milliseconds), so make sure the converter handles that. - Timezone handling: Do you want the output in UTC or your local time? Most converters offer both.
- Bulk conversion: If you have many timestamps, a converter that accepts a list or a file is useful.
- Reverse conversion: Can it convert from a date to a timestamp as well? Not all do both directions.
- Leap second awareness: For scientific work, you might need a converter that explicitly handles leap seconds, though most standard converters ignore them.
Common Problems and Pitfalls
Several issues trip up users:
- Milliseconds vs. seconds: A timestamp like 1700000000000 (13 digits) is in milliseconds, not seconds. Dividing by 1000 gives the correct seconds value. Many converters have a separate field for milliseconds.
- Timezone confusion: The timestamp is always UTC, but when you convert to a date, the converter may apply your local timezone. If you expect UTC, you might see a different date. Always check whether the output says UTC or local.
- Negative timestamps: Dates before 1970 produce negative timestamps. Some converters handle them, but others may not. For example, 1960-01-01 is -315619200 seconds.
- Year 2038 problem: On 32-bit systems, timestamps are stored as signed 32-bit integers, which overflow on January 19, 2038. Most modern systems use 64-bit integers, but older software may fail. This is a real concern for legacy systems.
Unix Time vs. Other Time Formats
Unix time is one of many time representations. It differs from ISO 8601 (e.g., 2023-11-14T22:13:20Z), which is human-readable and includes timezone info. It also differs from epoch milliseconds used in many programming languages. The key advantage of Unix time is its simplicity for arithmetic and storage—it is just a number. The disadvantage is that it is not human-readable without conversion.
Other systems like NTP (Network Time Protocol) use a different epoch (1900) and a different fraction representation. When working with network protocols, you may need to convert between these formats. However, for most developers, Unix time is the default.
Safety and Accuracy Considerations
When using a Unix time converter, accuracy is critical, especially in financial transactions, logging, and scientific data. Always verify the output with a second source if the data is important. Be aware that some converters round or truncate fractional seconds. Also, remember that the timestamp does not include timezone information—it is always UTC. If you store timestamps, store them in UTC and convert only for display.
For critical applications, consider using a library or a well-tested converter rather than a random online tool. Also, be cautious when converting timestamps from untrusted sources: a timestamp like 9999999999 might be valid but could represent a date far in the future (2286). Always validate ranges.
Frequently Asked Questions
What is the Unix timestamp for January 1, 2024, 00:00:00 UTC?
That timestamp is 1704067200. You can calculate it by counting the number of seconds from 1970-01-01 to 2024-01-01: 54 years × 365.25 days (accounting for leap years) gives approximately 1,704,067,200 seconds, but the exact value is 1,704,067,200 because 2023 is not a leap year and the calculation is exact.
Why does my converter show a different date than I expect?
Most likely because of timezone. The timestamp is UTC, but if your converter displays the result in your local timezone, the date may shift by a day. For example, a timestamp of 1700000000 is 2023-11-14T22:13:20Z, which is 2023-11-15 00:13:20 in UTC+2. Check the converter’s timezone setting.
How do I convert a Unix timestamp in Excel?
In Excel, you can use the formula =(A1/86400)+DATE(1970,1,1) to convert seconds to a date, then format the cell as a date. If your timestamp is in milliseconds, divide by 86400000 instead. For the reverse, use =(A1-DATE(1970,1,1))*86400.
What happens on January 19, 2038?
On 32-bit systems, the signed 32-bit integer overflows, causing the timestamp to become negative, which is interpreted as a date in 1901. This is known as the Year 2038 problem. Most modern systems use 64-bit integers, which will not overflow for billions of years, but legacy embedded systems may still be affected.
Do Unix timestamps include leap seconds?
No. Unix time ignores leap seconds. When a leap second occurs, the Unix timestamp repeats the previous second. This means that the actual UTC time can differ from the timestamp by up to one second. For most applications, this is negligible, but for precise scientific measurements, you need to account for it.
Can I convert a timestamp with milliseconds?
Yes. If you have a timestamp like 1700000000000 (milliseconds), divide by 1000 to get seconds. Many converters have a separate field or automatically detect the length. Always check the units before using the result.
Related
Formula used
in t | Unix timestamp | seconds | 1700000000 | 0 in d | Date (YYYY-MM-DD) | - | 2023-11-14 | 0 out ts | Converted timestamp | seconds | t | 0 out dt | Converted date (UTC) | - | d | 0
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.