# How to convert a date to a Unix timestamp in Excel

Subtract January 1, 1970 and multiply by the seconds in a day: `=(A2-DATE(1970,1,1))*86400`.

**Excel:** `=(A2-DATE(1970,1,1))*86400` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B |
| --- | --- |
| Date and time (UTC) | Unix time |
| 46082.5625 |  |
| 46096.336805555555 |  |
| 46203.989583333336 |  |
| 46324 |  |
| 46388.5 |  |

Formula in B2, filled to B6: `=(A2-DATE(1970,1,1))*86400`

Result: 1772371800; 1773561900; 1782863100; 1793232000; 1798804800

## How it works

Subtracting January 1, 1970 gives the days since the Unix epoch, and multiplying by 86,400 turns days into seconds. Times are fractions of a day, so they carry through: 1:30 PM adds 48,600 seconds.

## Other ways

- `=(A2-25569)*86400`: The same with the serial number of January 1, 1970 typed in.
- `=ROUND((A2-DATE(1970,1,1))*86400,0)`: Rounds away tiny floating-point remainders, so exports get a whole number.

## Common mistakes

- Unix time is UTC. Convert local times first, for example `(A2+5/24-DATE(1970,1,1))*86400` for US Eastern Standard Time.
- Some systems expect milliseconds: multiply by 86,400,000 instead.

## Questions

**How do I convert it back?**

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

**How do I get the current Unix time?**

`=(NOW()-DATE(1970,1,1))*86400`, adjusted for your time zone, since NOW is local time.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/convert-a-date-to-a-unix-timestamp
