Unix Timestamp to Date Converter (12-Hour or 24-Hour)
Converts a Unix timestamp to a calendar date and time. Detects second, millisecond and microsecond precision, and shows the result in 12-hour or 24-hour format.
Unix Timestamp Converter
Supports standard (10), millisecond (13), or microsecond (16) precision timestamps
Converted Date & Time
What is a Unix Timestamp?
A Unix timestamp is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds. It is used widely in Unix systems and programming languages for date and time calculations.
Documentation
Unix timestamp to date converter
A Unix timestamp is a number that represents a specific point in time. It counts the whole seconds that have passed since midnight UTC on January 1, 1970, a moment called the Unix epoch. This tool converts a Unix timestamp into a calendar date and clock time, shown in either 24-hour or 12-hour format.
How to convert a Unix timestamp to a date
The basic formula is simple:
date = Unix epoch (1970-01-01, 00:00:00 UTC) + timestamp (in seconds)
To turn a raw number of seconds into a date, add that many seconds to January 1, 1970. The result then has to be split into a year, month, day, hour, minute, and second. That split is the hard part, because it must account for leap years (which add a day to February) and the fact that months have different lengths. Most programming languages have a built-in date function that does this automatically, so nobody has to work it out step by step.
Worked example
Take the timestamp 1609459200.
- Divide by the number of seconds in a day: 1,609,459,200 รท 86,400 = 18,628 days.
- Count 18,628 days forward from January 1, 1970, keeping track of leap years along the way.
- The count lands on January 1, 2021.
So 1609459200 converts to Friday, January 1, 2021, 00:00:00 UTC. The weekday, Friday, falls out of the same day count.
A timestamp can also be negative, which represents a date before 1970. For example, -86400 is exactly one day before the epoch: December 31, 1969, 00:00:00 UTC.
Timestamp precision: seconds, milliseconds, and microseconds
Not every system measures time in seconds. This converter looks at how many digits a timestamp has and guesses its precision:
| Digits | Precision | Example |
|---|---|---|
| 10 | Seconds | 1609459200 |
| 13 | Milliseconds | 1609459200000 |
| 16 | Microseconds | 1609459200000000 |
A negative timestamp gets one extra digit for the minus sign, so -1609459200 (11 digits) is still read as seconds. Any other digit count is treated as plain seconds. Millisecond and microsecond values are divided by 1,000 or 1,000,000 before the seconds formula above is applied.
12-hour and 24-hour time format
The converter offers two ways to display the time of day.
- 24-hour format counts hours from 0 to 23, with no AM or PM label. Programmers sometimes call it military time. 3:00 in the afternoon is written 15:00.
- 12-hour format counts hours from 1 to 12, adding AM for the period from midnight to noon and PM for the period from noon to midnight. 15:00 in 24-hour format becomes 3:00 PM.
The 24-hour format is standard across most of Europe, Latin America, and Asia, and in scientific, military, and medical settings everywhere. The 12-hour format remains common for everyday use in the United States, Canada, and a few other English-speaking countries.
Supported date range
This converter accepts any timestamp from -62167219200 to 253402300799, which covers every date from the year 0 through December 31, 9999. Timestamps outside that range are rejected as too large or too small to convert.
The Year 2038 problem
Many older computer systems store a Unix timestamp as a 32-bit signed integer, which can only count up to 2,147,483,647. That number of seconds after the epoch falls on January 19, 2038, at 03:14:07 UTC. Past that instant, an unpatched 32-bit system wraps back around to a negative number and reads the date as being in 1901 instead of 2038. This is known as the Year 2038 problem. It does not affect every system: modern software that stores timestamps as 64-bit numbers, or as ordinary numbers the way JavaScript does, can represent dates thousands of years beyond 2038 without any overflow.
Common uses of Unix timestamps
Unix timestamps show up throughout computing because they are compact and easy to compare or sort:
- Database rows use them to record when a record was created or last changed.
- Web servers use them in HTTP headers and cookies to control caching and expiration.
- Log files stamp each event with one, so entries can be lined up in order.
- Git and other version-control systems record commit times this way.
- Web APIs use them to mark when data was generated or last updated.
Frequently asked questions
What is the Unix epoch? The Unix epoch is midnight UTC on January 1, 1970. It is the zero point that all Unix timestamps count from.
Does a Unix timestamp include leap seconds? No. Unix time counts exactly 86,400 seconds per day and ignores the leap seconds occasionally added to UTC, so it drifts slightly out of step with astronomical time.
Can a Unix timestamp be negative? Yes. A negative value represents a date before January 1, 1970.
Why does my timestamp have 13 digits instead of 10?
A 13-digit timestamp is measured in milliseconds rather than seconds. JavaScript's Date.now() and many web APIs return timestamps in milliseconds, which is why 13-digit values are common in web development.
Is a Unix timestamp the same in every time zone? The number itself is not tied to any time zone; it always counts seconds since the epoch in UTC. Converting it to a local date and time, such as "3:00 PM Eastern," requires applying a time zone offset on top of the raw timestamp.
What is the largest date this converter can handle? December 31, 9999, at 23:59:59 UTC, which corresponds to the timestamp 253402300799.