How to convert a date to a Unix timestamp in Excel
Formula (Excel and Google Sheets)
=(A2-DATE(1970,1,1))*86400Subtract January 1, 1970 and multiply by the seconds in a day: =(A2-DATE(1970,1,1))*86400.
- Result on the example
- one result per row in
B2, filled down toB6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
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.
=(A2-DATE(1970,1,1))*86400Result1772371800
A23/1/2026 13:30The value in A2.
DATE(1970,1,1)1/1/1970 (25569)DATE: Builds a date from parts.- year
1970 - month
1 - day
1
- year
A2-DATE(1970,1,1)20513.5625The - operator subtracts.
A2-DATE(1970,1,1))*864001772371800The * operator multiplies.
In Google Sheets
The same formula works in Google Sheets: =(A2-DATE(1970,1,1))*86400. We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =(A2-25569)*86400 | 1772371800, 1773561900, 1782863100… | The same with the serial number of January 1, 1970 typed in. |
| =ROUND((A2-DATE(1970,1,1))*86400,0) | 1772371800, 1773561900, 1782863100… | 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))*86400for US Eastern Standard Time. - Some systems expect milliseconds: multiply by 86,400,000 instead.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Convert a date to a Unix timestamp
B2, convert the UTC date and time to a Unix timestamp in seconds, and fill down to B6.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.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.