How to Convert a Unix Timestamp to a Date in Excel or Google Sheets
Formulas to turn Unix timestamps (seconds or milliseconds) into readable dates in Excel and Google Sheets, shift UTC to IST, and convert dates back to epoch.
The short answer
In Excel, a Unix timestamp in seconds converts with =A2/86400+DATE(1970,1,1), then format the cell as a date and time. For milliseconds, divide by 86400000 instead. In Google Sheets you can also use =EPOCHTODATE(A2). Both give the time in UTC; add TIME(5,30,0) for Indian time. To check a single value quickly, paste it into the Timestamp Converter.
Why the formula works
- A Unix timestamp counts seconds since 1 January 1970, 00:00 UTC.
- Excel and Google Sheets store a date as a number of days, where the whole part is the date and the decimal part is the time of day.
- A day has 86,400 seconds, so
A2/86400turns seconds into days, and addingDATE(1970,1,1)moves the count to start from 1970.
Using DATE(1970,1,1) rather than a fixed number such as 25569 keeps the formula correct even in a workbook that uses Excel's 1904 date system, because DATE always returns the right serial number for that workbook.
Step by step in Excel
| Timestamp unit | Example | Formula |
|---|---|---|
| Seconds (10 digits) | 1767225600 | =A2/86400+DATE(1970,1,1) |
| Milliseconds (13 digits) | 1767225600000 | =A2/86400000+DATE(1970,1,1) |
dd-mm-yyyy hh:mm:ss (or yyyy-mm-dd hh:mm:ss for ISO style).Worked example: 1767225600 ÷ 86400 = 20454 days after 1 January 1970. Excel shows the result as serial 46023, which formats as 01-01-2026 00:00:00 (UTC).
Step by step in Google Sheets
The same formula works in Sheets. Sheets also has a built-in function:
=EPOCHTODATE(A2)for seconds (the default unit)=EPOCHTODATE(A2, 2)for milliseconds=EPOCHTODATE(A2, 3)for microseconds
According to Google's documentation, EPOCHTODATE returns the time in UTC, not in your spreadsheet's time zone, drops fractional milliseconds, and does not accept negative timestamps (dates before 1970). For a pre-1970 value, use the division formula instead.
A column with both seconds and milliseconds
Exports from different systems sometimes mix 10-digit and 13-digit timestamps in one column. One formula can handle both by checking the length of the number:
=IF(LEN(A2)=13,A2/86400000,A2/86400)+DATE(1970,1,1)
LEN counts the digits, so a 13-digit value is treated as milliseconds and anything else as seconds. This works for dates from late 2001 onwards, when second-based timestamps reached 10 digits. Check a handful of rows against the original data after filling the formula down, especially if your source might also contain microseconds or blank cells. To leave blanks empty instead of showing 1 January 1970, wrap it: =IF(A2="","",your formula).
Convert UTC to your local time
A timestamp has no time zone; the formulas above give you UTC. Add or subtract your offset:
| Time zone | Add to the formula |
|---|---|
| India (IST, UTC+5:30) | +TIME(5,30,0) |
| UAE (UTC+4) | +TIME(4,0,0) |
| UK in winter (UTC+0) | nothing |
For example, the full IST formula for seconds is =A2/86400+DATE(1970,1,1)+TIME(5,30,0). The timestamp 1700000000 becomes 14-11-2023 22:13:20 in UTC and 15-11-2023 03:43:20 in IST. Notice that the date changes too.
For time zones that switch to daylight saving time (the UK, most of Europe and the US), a fixed offset is only right for part of the year. If you need exact local times across those changes, convert in your code or database, where time zone rules are built in.
Convert a date back to a Unix timestamp
To go the other way, reverse the steps:
- Seconds:
=(A2-DATE(1970,1,1))*86400 - Milliseconds:
=(A2-DATE(1970,1,1))*86400000
If your date in A2 is in IST, subtract the offset first: =(A2-TIME(5,30,0)-DATE(1970,1,1))*86400. For example, 26-10-2026 18:30 IST gives 1793019600.
Format the result cell as Number with zero decimal places. Otherwise Excel may show it in scientific notation, such as 1.79E+09.
How to tell seconds from milliseconds
- 10 digits (for current dates): seconds. For example 1767225600.
- 13 digits: milliseconds. For example 1767225600000.
- 16 digits: microseconds, used by some databases and logging tools.
If you use the seconds formula on a millisecond value, you get a date tens of thousands of years in the future, which Excel shows as ##### because it is beyond its date range. Use the milliseconds formula instead.
Troubleshooting
- You see a five-digit number like 46023. The formula worked; apply a date format.
- You see ######. The column is too narrow, or the value is far outside Excel's date range (often milliseconds treated as seconds).
- The result is 5 hours 30 minutes off. You are seeing UTC. Add
TIME(5,30,0)for IST. - The timestamp was pasted as text. If the number is left-aligned or has a green triangle, wrap it:
=VALUE(A2)/86400+DATE(1970,1,1). - Long millisecond values lose their last digits. Excel keeps 15 significant digits, which is enough for 13-digit milliseconds but not for longer values. Keep long IDs and microsecond values as text.
Checking a value with the Lazyblink tool
The Timestamp Converter is handy for spot-checking a few rows before you trust a whole column:
For background on why timestamps use seconds or milliseconds and what the 2038 problem is, see Unix Timestamps Explained: Seconds vs Milliseconds, Time Zones and the Year 2038.
Frequently asked questions
What is the Excel formula to convert a Unix timestamp to a date?
For seconds, use =A2/86400+DATE(1970,1,1). For milliseconds, use =A2/86400000+DATE(1970,1,1). Then format the cell as a date and time.
How do I convert epoch time to a date in Google Sheets?
Use =EPOCHTODATE(A2) for seconds or =EPOCHTODATE(A2, 2) for milliseconds. The result is in UTC.
How do I convert a Unix timestamp to IST in Excel?
Add 5 hours 30 minutes: =A2/86400+DATE(1970,1,1)+TIME(5,30,0) for a timestamp in seconds.
Why does Excel show a number like 46023 instead of a date?
Excel stores dates as day numbers. The formula worked; apply a date format such as dd-mm-yyyy hh:mm:ss to see the date.
Put this guide into practice with our free online tool — no signup required.
Open tool