How do you convert a Unix timestamp to a date?
To convert a Unix timestamp to a date, paste the number into the Unix time box above and read the result in the formatted time box. A 10-digit value is in seconds. A 13-digit value is in milliseconds, so divide it by 1,000 first if the result looks wrong.
For example, 1800000000 is Friday, January 15, 2027, 08:00:00 UTC. In New York that moment is 3:00 AM, and in Ho Chi Minh City it is 3:00 PM.
How do you convert a date to a Unix timestamp?
To convert a date to a timestamp, type the date and time into the formatted time box; the Unix time box shows the matching number. The time is read in your device's time zone, so the same clock time gives a different timestamp in each city.
Noon in Hanoi and noon in London are 7 hours apart in winter and 6 in summer, so their timestamps differ by 25,200 or 21,600 seconds. When you need the timestamp for another city's local time, check that city's offset first in the time zone converter.
How do you convert timestamps in Excel and code?
Excel and Google Sheets store dates as days since 1900, so a Unix timestamp in A1 becomes a date with =A1/86400+DATE(1970,1,1), formatted as a date and time. The result is in UTC; add the offset in hours divided by 24 to get local time.
- JavaScript: new Date(1800000000 * 1000).toISOString()
- Python: datetime.fromtimestamp(1800000000, tz=timezone.utc)
- PHP: date('Y-m-d H:i:s', 1800000000)
- MySQL: SELECT FROM_UNIXTIME(1800000000);
The reasoning behind the 1970 start and the 2038 limit is in what Unix time is.
Frequently asked questions
Why is my converted date off by a few hours?
A converted date that is off by whole hours is almost always a time zone mix-up. The timestamp itself is in UTC; one tool may show UTC while another shows local time. Check which zone each result uses before comparing them.
Why does my timestamp convert to 1970 or to the year 50000?
A date in January 1970 means a seconds value was read as milliseconds, which shrinks it 1,000 times. A date tens of thousands of years ahead means the opposite: milliseconds were read as seconds. Count the digits: 10 for seconds, 13 for milliseconds.
What date format should I use in an API?
Use either a Unix timestamp or an ISO 8601 string with an offset, such as 2027-01-15T08:00:00Z. Both are unambiguous across time zones. The format rules are in the ISO 8601 date and time format guide.
