Excel Epoch to Date: Step-by-Step Conversion Guide
In this article
To convert an epoch timestamp to a readable date in Excel, divide the number by 86,400 (the number of seconds in a day), add the epoch start date (January 1, 1970, for Unix time), and format the result as a date and time. The formula is: =(A1/86400)+DATE(1970,1,1) for seconds, or =(A1/86400)+DATE(1970,1,1) for milliseconds after dividing by 1000 first. This works because Excel stores dates as serial numbers where 1 equals one day, so converting seconds to days and adding the epoch base gives a valid Excel date. You will need your epoch values in a column and a basic understanding of Excel formulas.
What You'll Need
- Microsoft Excel (any recent version, desktop or web) or a compatible spreadsheet app like Google Sheets or LibreOffice Calc.
- Epoch timestamps in a column (numbers only, no extra text).
- Knowledge of whether your timestamps are in seconds or milliseconds (Unix time is usually seconds; JavaScript and some APIs use milliseconds).
Step-by-Step
- Identify your epoch unit. Check a sample value: a 10-digit number (e.g., 1697049600) is seconds; a 13-digit number (e.g., 1697049600000) is milliseconds. If unsure, compare with a known date using an online converter.
- Enter your timestamps. Put them in column A starting at A2. Ensure they are stored as numbers, not text. If they are left-aligned, they may be text; convert via Data > Text to Columns or multiply by 1.
- Write the conversion formula. In B2, for seconds:
=(A2/86400)+DATE(1970,1,1). For milliseconds:=(A2/86400000)+DATE(1970,1,1). Press Enter. - Format as date/time. Right-click B2, choose Format Cells, then Date or Custom. Use a format like
yyyy-mm-dd hh:mm:ssto see both date and time. Click OK. - Fill down. Drag the fill handle from B2 down to apply the formula to all rows.
- Adjust for time zone (optional). Excel uses the local time zone of your computer for display, but the formula returns UTC. To convert to a specific time zone, add or subtract hours: e.g., for UTC+2, add
2/24to the formula:=(A2/86400)+DATE(1970,1,1)+2/24.
Common Mistakes
- Using the wrong divisor. Dividing by 86,400 when the timestamp is in milliseconds gives a date in the year 1970 or an error. Always check the digit count.
- Forgetting to format as date. The formula returns a serial number (e.g., 45200.5). Without date formatting, it looks like a meaningless decimal.
- Treating text as numbers. If timestamps are stored as text (often from CSV imports), formulas may return #VALUE!. Convert them to numbers first.
- Ignoring time zone. The result is in UTC. If you need local time, add or subtract the offset manually.
- Using the wrong epoch base. Some systems (like Mac OS Classic) use 1904 as the base. Excel for Windows uses 1900; check your source.
Tips
- Use
DATE(1970,1,1)instead of typing 25569 (the serial number for 1970-01-01) to make the formula self-documenting. - For quick checks, use an online epoch converter to verify your formula output.
- If you work with both seconds and milliseconds, add a helper column to standardize units before conversion.
- To display only the date without time, use the format
yyyy-mm-dd. - Excel's date system has a known leap year bug (1900 treated as leap), but it does not affect dates after March 1, 1900, so epoch conversions are safe.
Troubleshooting
- Formula returns a number like 45200.5 instead of a date: Format the cell as a date (Format Cells > Date).
- #VALUE! error: The timestamp cell contains text or spaces. Clean it with
=TRIM(A2)or use Text to Columns to convert. - Result is off by hours: You may need to adjust for time zone. Add or subtract the offset in hours divided by 24.
- Result shows 1900 or 1970 for all rows: The divisor is likely wrong (e.g., using 86400 for milliseconds). Double-check the unit.
- Dates before 1970: The formula works for negative epoch values (dates before 1970) as long as Excel's date system supports them (Excel for Windows starts at 1900).
Frequently Asked Questions
Can I convert epoch to date without a formula?
Yes, you can use Power Query: import your data, add a custom column with the formula #datetime(1970,1,1,0,0,0) + #duration(0,0,0,[Epoch]) for seconds, then expand. But the formula method is faster for simple cases.
What if my epoch is in milliseconds?
Divide by 86,400,000 instead of 86,400. So the formula becomes =(A2/86400000)+DATE(1970,1,1).
Why does my converted date show as 1/1/1970?
This usually means the timestamp is being treated as zero or the formula is not referencing the correct cell. Check that the cell contains a number and the formula points to it.
Does Excel handle time zones automatically?
No, Excel's date functions do not account for time zones. The conversion yields UTC. You must manually add or subtract the offset for your local time.
Can I convert a date back to epoch in Excel?
Yes, use =(A2-DATE(1970,1,1))*86400 for seconds, or multiply by 86400000 for milliseconds.
What about Mac Excel's 1904 date system?
Mac Excel can use the 1904 date system, which shifts serial numbers by 1462 days. If your results are off by about 4 years, check File > Options > Advanced > When calculating this workbook, and ensure the 1904 box is unchecked (or adjust the formula by adding 1462).