How to Convert Unix Timestamps in Excel and Google Sheets
Opening a database CSV export in Excel often turns readable dates into large 10-digit numbers like 1764892800 or 5-digit numbers like 46361. Excel has no built-in Unix timestamp function, so formatting the cell as a Date shows ####### until you apply the right offset formula.
Excel Formula: Unix Timestamp to Readable Date
Excel stores dates as days counted from January 1, 1900, where fractional decimals represent hours and minutes. Unix time counts seconds from January 1, 1970. The exact gap between those two starting points in Excel is 25,569 days.
Assuming your Unix timestamp sits in cell A2, enter one of these formulas in B2 and then format cell B2 as a Date or Custom format yyyy-mm-dd hh:mm:ss:
// For 10-digit Unix Seconds (UTC):
=(A2/86400)+25569
// For 13-digit Unix Milliseconds (UTC):
=(A2/86400000)+25569
If you want to shift the UTC output into a local fixed offset (for example, UTC+05:00), add the hour fraction to the formula: =(A2/86400)+25569+(5/24).
Excel Formula: Normal Date Back to Unix Seconds
To turn an Excel calendar cell in A2 back into a 10-digit Unix timestamp, subtract 25569 and multiply by 86400 seconds per day. Make sure the result cell uses the General or Number format.
=(A2-25569)*86400
Why the Magic Number 25569 Includes a 1900 Bug
You might calculate 70 years between 1900 and 1970 and expect 25,567 days instead of 25,569. Two quirks explain the extra two days. First, Excel starts counting at January 1, 1900 as serial 1 instead of 0. Second, early Microsoft spreadsheets copied a compatibility quirk from Lotus 1-2-3 that falsely treats 1900 as a leap year, inserting a fake February 29, 1900 (serial 60), as explained in the Microsoft Excel 1900 Leap Year documentation.
Google Sheets matches Excel serial numbers on every date from March 1, 1900 onward, so the exact same 25569 formulas work identically in both Excel and Google Sheets.
Watch Out for Old Mac 1904 Workbooks
If your converted dates appear four years and one day off (1,462 days), open Excel Options and check whether the file uses the legacy 1904 Date System from older Mac spreadsheets. Uncheck that setting or adjust the constant to 24107.