Cellwise Start free

Excel guide · 5 min read

How to convert a Unix timestamp to a date in Excel

Quick answerDivide the timestamp by 86,400 (the seconds in a day) and add the Unix start date: =A2/86400+DATE(1970,1,1). Then format the cell as yyyy-mm-dd hh:mm:ss. For 13-digit millisecond timestamps divide by 86,400,000 instead. The result is in UTC; add your offset in hours divided by 24 for local time.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFG
1Ordercreated_at (Unix s)paid_at (Unix ms)Mixed exportISO 8601 textUTC offset (hours)
2SO-5081217937846001.7938E+1217937846002026-11-04T09:30:00Z-5
3SO-5081317938011121.7938E+121.7938E+122026-11-04T14:05:12Z
4SO-5081417937497101.7937E+1217937497102026-11-03T23:48:30ZSale starts (local)
5SO-5081517938593001.7939E+121.7939E+122026-11-05T06:15:00Z46353.375
6SO-5081617939005291.7939E+1217939005292026-11-05T17:42:09Z

Download this sheet as an Excel practice file (.xlsx)

The formula and why it works

A Unix timestamp counts seconds since midnight UTC on January 1, 1970. Excel counts days since January 1, 1900, and stores the time of day as a fraction. So the conversion has two steps: divide by 86,400 to turn seconds into days, then add the serial number of January 1, 1970, which DATE(1970,1,1) gives you.

The sheet is an order export from a web shop. Order SO-50812 has created_at 1793784600. The formula returns 46330.395833: day 46330 is November 4, 2026 and .395833 of a day is 9:30 AM.

Excel may show the raw number or only the date, depending on the format the cell picks up. Select the column, press Ctrl+1, choose Custom and type yyyy-mm-dd hh:mm:ss to see the time as well.

=B2/86400+DATE(1970,1,1)

Result: Nov 4, 2026 shows as 2026-11-04 09:30:00 with the custom yyyy-mm-dd hh:mm:ss format

46330.395833, November 4, 2026 at 09:30:00 UTC.

Millisecond timestamps (13 digits)

JavaScript, many APIs and most logging tools record milliseconds, not seconds. Those timestamps have 13 digits instead of 10, and there are 86,400,000 milliseconds in a day.

Divide one by 86,400 by mistake and you get a date in the year 58812, which Excel cannot display, so the cell fills with #####. That is the giveaway that you have milliseconds.

The seconds format rounds away the milliseconds (09:31:02.417 shows as 09:31:02). To see them, use the custom format yyyy-mm-dd hh:mm:ss.000 on the cell.

=C2/86400000+DATE(1970,1,1)

Result: Nov 4, 2026 shows as 2026-11-04 09:31:02 with the custom yyyy-mm-dd hh:mm:ss format

November 4, 2026 at 09:31:02 UTC, the moment SO-50812 was paid.

A column with both: check the length

Exports that merge two systems sometimes mix seconds and milliseconds in one column, like D here. LEN works on numbers too: it returns 10 for a seconds timestamp and 13 for milliseconds, so let IF pick the divisor.

This holds for any date between 2001 and 2286, which covers real data. If a value has some other length, it is not a Unix timestamp in seconds or milliseconds (microseconds have 16 digits, and Excel only keeps 15 significant digits, so ask for a different export).

=IF(LEN(D3)=13,D3/86400000,D3/86400)+DATE(1970,1,1)

Result: Nov 4, 2026 shows as 2026-11-04 14:05:12 with the custom yyyy-mm-dd hh:mm:ss format

November 4, 2026 at 14:05:12 for the 13-digit value in D3. The same formula reads the 10-digit value in D2 as 09:30:00.

Convert to your time zone with an offset cell

Unix time is always UTC. To show local time, put the offset in hours in its own cell (G2 holds -5 for New York in winter) and add it divided by 24, because Excel counts in days. Use $G$2 so the reference stays put when you fill down.

SO-50814 was created at 23:48:30 UTC on November 3. In New York that is 18:48:30 the same day. The date can change too: a late-evening UTC time can be the next morning in Asia. Half-hour zones work the same way: type 5.5 for India.

Excel has no time zone rules, so daylight saving is up to you. Change G2 when the clocks change, or add an offset column next to the dates if the data spans a switch. Keep the UTC column as the source of truth and convert from it.

=B4/86400+DATE(1970,1,1)+$G$2/24

Result: Nov 3, 2026 shows as 2026-11-03 18:48:30 with the custom yyyy-mm-dd hh:mm:ss format

November 3, 2026 at 18:48:30, New York time for SO-50814.

Back the other way: Excel date to Unix timestamp

Reverse the steps: subtract January 1, 1970, multiply by 86,400, and remove your offset first if the date is local time. G5 holds the local start of a sale, November 27, 2026 at 9:00 AM in New York.

Wrap the result in ROUND. Excel stores times as binary fractions, and multiplying back up can leave a tiny decimal that breaks an exact match in an API call or a lookup. Multiply by 86,400,000 instead if the other system expects milliseconds.

NOW() returns your computer's local time, not UTC, so =(NOW()-DATE(1970,1,1))*86400 is off by your offset. Subtract $G$2/24 as well.

=ROUND((G5-$G$2/24-DATE(1970,1,1))*86400,0)

Result: 1795788000

1795788000, which is 14:00 UTC on November 27, 2026. Without the offset you would get 1795770000, five hours early.

ISO 8601 text like 2026-11-04T09:30:00Z

Many APIs send dates as text in ISO format: date, a T, the time, and Z for UTC. Excel does not read that whole string as a date, so DATEVALUE on it fails. Cut it into parts with LEFT and MID and rebuild it with DATE and TIME, which works in every version and every regional setting.

If the text ends with an offset such as +02:00 instead of Z, the time shown is local to that offset. Subtract the offset (2/24) to get UTC. A shorter alternative is =DATEVALUE(LEFT(E2,10))+TIMEVALUE(MID(E2,12,8)). To turn the result into a Unix timestamp, use the formula in the previous section with an offset of 0.

=DATE(LEFT(E2,4),MID(E2,6,2),MID(E2,9,2))+TIME(MID(E2,12,2),MID(E2,15,2),MID(E2,18,2))

Result: Nov 4, 2026 shows as 2026-11-04 09:30:00 with the custom yyyy-mm-dd hh:mm:ss format

November 4, 2026 at 09:30:00, a real date-time you can sort, filter and subtract.

Common mistakes

Seeing ##### after the conversion

The value is probably in milliseconds, which gives a date tens of thousands of years ahead. Check LEN: if it is 13, divide by 86,400,000.

Typing 25569 instead of DATE(1970,1,1)

25569 is January 1, 1970 only in the default 1900 date system. A workbook set to the 1904 date system (File > Options > Advanced) turns the epoch into January 2, 1974, so every date comes out about four years late. DATE(1970,1,1) is right in both.

Treating the result as local time

Unix time is UTC. Add an offset cell divided by 24, and update it when daylight saving starts or ends.

Comparing a converted date with a plain date

The result includes the time, so it only equals DATE(2026,11,4) at exactly midnight. Use INT() on it to keep only the date before matching or counting by day.

FAQ

How do I convert epoch time to a date in Excel?

Epoch time is another name for Unix time. Use =A2/86400+DATE(1970,1,1) for seconds or =A2/86400000+DATE(1970,1,1) for milliseconds, then format the cell as a date and time.

How do I convert a 13-digit timestamp in Excel?

A 13-digit timestamp is in milliseconds. Divide by 86,400,000 instead of 86,400: =A2/86400000+DATE(1970,1,1).

How do I get just the date from a Unix timestamp?

Wrap the conversion in INT: =INT(A2/86400+DATE(1970,1,1)). Add the time zone offset inside the INT, before rounding down, or rows near midnight land on the wrong day.

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

=ROUND((A2-DATE(1970,1,1))*86400,0) when A2 is in UTC. If A2 is local time, subtract the offset first: =ROUND((A2-offset/24-DATE(1970,1,1))*86400,0).

Why is my converted Unix time a few hours off?

The timestamp is UTC and you are comparing it with local time. Add your offset in hours divided by 24, for example +$G$2/24 with -5 in G2.

Functions used

Related guides

Updated