How to convert a Unix timestamp to a date in Excel and Google Sheets

By TechCompare · Updated · How we check

Divide seconds by 86400 and add 25569, the serial number of January 1, 1970, then format the cell as a date. Milliseconds need 86400000 instead, and the result is in UTC.

A Unix timestamp counts seconds, and a spreadsheet date counts days, so a sheet needs converting before it can show a real date. The example here is 1780511400, which is June 3, 2026 at 18:30:00 UTC. This page covers seconds, milliseconds, the reverse trip, and the time zone problem.

Unix timestamp
1,780,511,400
Seconds since epoch
ISO 8601
2026-06-03T18:30:00.000Z
Wed, 03 Jun 2026 18:30:00 GMT
Category
Spreadsheets
Timestamp knowledge base

How this is calculated

Excel stores dates as sequential serial numbers, so each date is a count of days, and the time of day is the fraction after the decimal point. Unix time counts seconds from January 1, 1970 UTC. That date is serial 25569 in the 1900 date system. For this moment, the serial comes out to 46176.77083, and in the 1904 date system it's 44714.77083. If cell A2 holds 1780511400 in seconds, the first line below returns its serial number. The second line does the same with the fixed number, and the third is for a cell that holds milliseconds.

Excel
=A2/86400+DATE(1970,1,1)
=A2/86400+25569
=A2/86400000+DATE(1970,1,1)

Each formula returns a serial number. If the cell shows a plain number, apply a date and time format. DATE returns the serial for January 1, 1970 in whichever date system the workbook uses, but 25569 only fits the 1900 system. In a 1904 workbook, the fixed version lands on the wrong year.

Going back helps when a date column has to match an API filter that wants a timestamp. Start with a cell that holds a date and time in UTC. This formula subtracts the epoch serial, multiplies by 86400 to get seconds, and rounds the result.

Date to timestamp
=ROUND((A2-DATE(1970,1,1))*86400,0)

ROUND removes the tiny floating point error that decimal fractions of a day leave behind. Without it, the result can land a hair under a whole second, and a function that cuts off decimals then returns one second less than you meant.

Google Sheets has a shortcut for the forward trip. EPOCHTODATE reads seconds by default, a second argument of 2 means milliseconds, and 3 means microseconds. Both lines below return a UTC datetime. The first reads A2 as seconds, and the second reads it as milliseconds.

Google Sheets
=EPOCHTODATE(A2)
=EPOCHTODATE(A2, 2)

The forward formulas above all give UTC, so a reader in another time zone sees the UTC clock time unless you shift it. For a reader in New York in June, the offset is UTC-4. Put its hours in cell B2 as a signed number, and the formula adds that many hours as a fraction of a day:

Local time
=A2/86400+DATE(1970,1,1)+B2/24

New York is UTC-4 in June and UTC-5 in January, so a B2 set for June shows the wrong time in January. A fixed offset only works when every date in the sheet shares it. For anything that crosses a daylight saving change, look up the offset for each date in a table, or convert the times before they reach the sheet.

Verdict

Check the date system before you trust 25569 as a fixed number. Dividing milliseconds by 86400 is an easy slip, and a 13-digit value divided that way gives a serial of 20633339.83333, which isn't the date you meant. For sheets that feed an API, round the reverse conversion and treat every converted value as UTC until you shift it.

More Timestamp scenarios

Frequently asked questions

Why does the formula divide by 86400?
A spreadsheet date counts days and a Unix timestamp counts seconds. A day has 86400 seconds, so dividing by 86400 turns the count into days. In the 1900 date system, skip the DATE part and Excel reads the bare day count as a date in 1956, not 2026.
Why does my cell show 46176.77083 instead of a date?
That's a serial number. The whole part counts days from the workbook's start date, and the decimal part is the time of day. A cell in the General format shows the raw number. Apply a date and time format and the same value reads as June 3, 2026 at 18:30:00, in the format's own pattern.
How do I convert a millisecond timestamp in Excel?
Divide by 86400000 instead of 86400, and keep DATE(1970,1,1). The seconds value 1780511400 has 10 digits, and its milliseconds version has 13, so count the digits before you pick a divisor. The seconds vs milliseconds page covers how to tell them apart.
Does EPOCHTODATE use my spreadsheet's time zone?
No. The EPOCHTODATE help page says the result "will be in UTC, not the local time zone of your spreadsheet." To show local time, shift the value by the offset, as the local time example above does.
How do I turn a date back into a Unix timestamp in Excel or Google Sheets?
Use the date to timestamp formula above and check it with a known pair. A cell holding June 3, 2026 at 18:30:00 UTC should return 1780511400. Google Sheets uses the same 1900 date system as Excel, so DATE(1970,1,1) is serial 25569 there too and the same formula works.