Skip to content
Dev Tools

Unix Timestamp to Date in Excel and Sheets

By · Published · Updated

In short: put the timestamp in A1 and type =A1/86400+DATE(1970,1,1) in the next cell, then format that cell as a date and time. It works the same in Excel and Google Sheets. For a 13-digit millisecond timestamp, divide by 86400000 instead of 86400. The answer is in UTC.

A Unix timestamp counts seconds since 1 January 1970 UTC. A spreadsheet counts days: Excel numbers each day from 1 January 1900, so the formula turns seconds into days and adds the day 1970 began. To check one value, paste it into the Unix Timestamp Converter and compare.

The formula for each unit

Count the digits of a present-day timestamp to see its unit, then use that row.

Unix timestamp to date formulas, timestamp in A1
UnitDigitsExcel and Google SheetsGoogle Sheets only
Seconds10=A1/86400+DATE(1970,1,1)=EPOCHTODATE(A1)
Milliseconds13=A1/86400000+DATE(1970,1,1)=EPOCHTODATE(A1,2)
Microseconds16=A1/86400000000+DATE(1970,1,1)=EPOCHTODATE(A1,3)
Nanoseconds19=A1/86400000000000+DATE(1970,1,1)None, use the formula

Convert a Unix timestamp to a date in Excel

  1. Put the timestamps in column A, starting in A1.
  2. In B1, type =A1/86400+DATE(1970,1,1) and press Enter. Excel shows a number like 45244.93, which is the date as a count of days.
  3. Select B1 and open Format Cells (Ctrl+1, or Cmd+1 on a Mac). Pick Custom and type yyyy-mm-dd hh:mm:ss. 1700000000 now reads 2023-11-14 22:13:20.
  4. Drag the corner of B1 down to fill the formula for the rest of the column.

Convert a Unix timestamp to a date in Google Sheets

The formula above works in Sheets too. Sheets also has its own function: =EPOCHTODATE(A1) for seconds, with a second argument of 2 for milliseconds and 3 for microseconds. It has no unit for nanoseconds and does not accept negative timestamps, so for those use the formula.

Show the date in your time zone

Both formulas give UTC. To move the result to your time zone, add your offset from UTC in hours divided by 24. New York in winter is 5 hours behind, so =A1/86400+DATE(1970,1,1)-5/24 turns 1700000000 into 17:13:20 on 14 November 2023.

UTC offsets for US time zones
Time zoneStandard time (winter)Daylight saving time (summer)
Eastern (New York)-5/24-4/24
Central (Chicago)-6/24-5/24
Mountain (Denver)-7/24-6/24
Pacific (Los Angeles)-8/24-7/24

A fixed offset does not follow daylight saving time. A column that spans March or November will be an hour off for part of the year, so check one date from each side.

Convert a date back to a Unix timestamp

With a date and time in A1, in UTC, use =(A1-DATE(1970,1,1))*86400 and format the cell as a plain number with no decimals. If A1 holds local time, subtract the same offset first: for New York in winter, add 5/24 to A1 before the subtraction.

When the result looks wrong

  • The year is 1970. The timestamp is in milliseconds and you divided by 86400 instead of 86400000, or the other way round, which gives a year far in the future.
  • The cell shows #####. The column is too narrow, so widen it. If it still shows #####, the date is before 1900, which Excel cannot show.
  • The last digits of a nanosecond timestamp turn into zeros. Excel keeps 15 significant digits, and a nanosecond timestamp has 19. The date is still right to the millisecond, which is as fine as Excel shows time.
  • A column mixes seconds and milliseconds. One formula cannot fit both. Paste the column into Convert a list on the Unix Timestamp Converter: it reads the unit of each line from its digits and gives the date in UTC.

What Microsoft and Google say

The facts above, in the words of Excel's and Google Sheets' own help pages.

  • In the 1900 date system, dates are calculated by using January 1, 1900, as a starting point. When you enter a date, it is converted into a serial number that represents the number of days elapsed since January 1, 1900.
    Microsoft: Date systems in Excel
  • In the 1904 date system, dates are calculated by using January 1, 1904, as a starting point.
    Microsoft: Date systems in Excel
  • Earliest date allowed for calculation January 1, 1900 (January 1, 1904, if 1904 date system is used)
    Microsoft: Excel specifications and limits
  • Number precision 15 digits
    Microsoft: Excel specifications and limits
  • The unit of time in which the timestamp is expressed. 1 indicates the time unit is seconds. 2 indicates the time unit is milliseconds. 3 indicates the time unit is microseconds.
    Google: EPOCHTODATE function
  • The result will be in UTC, not the local time zone of your spreadsheet. Negative timestamps aren’t accepted.
    Google: EPOCHTODATE function

Frequently asked questions

How do I convert a Unix timestamp to a date in Excel?

Put the timestamp in A1, type =A1/86400+DATE(1970,1,1) in B1 and format B1 with the custom format yyyy-mm-dd hh:mm:ss. The result is in UTC.

Sources: Microsoft, Date systems in Excel

How do I convert a millisecond timestamp in Excel?

Divide by 86400000, the number of milliseconds in a day: =A1/86400000+DATE(1970,1,1). A 13-digit timestamp is in milliseconds.

Is there a function for Unix time in Google Sheets?

Yes. =EPOCHTODATE(A1) reads seconds, and a second argument of 2 or 3 reads milliseconds or microseconds. The result is in UTC, and negative timestamps are not accepted.

Sources: Google, EPOCHTODATE function

How do I convert a date to a Unix timestamp in Excel?

With the date in A1, in UTC, use =(A1-DATE(1970,1,1))*86400 and format the cell as a number with no decimals.

Why is my Excel date four years off?

The workbook uses the 1904 date system and the formula adds 25569, a day number from the 1900 system. Use DATE(1970,1,1) instead of 25569 and it works in both.

Sources: Microsoft, Date systems in Excel

Checked against Microsoft's Excel help pages and Google's EPOCHTODATE page on 27 October 2026, with every formula tested on 1700000000.