Unix Timestamp in Excel

Spreadsheets do not use Unix time at all — they count days since 30 December 1899. Converting means both a scale change and an origin shift.

Need to convert one value rather than write code? Use the interactive converter — it handles every unit and time zone without leaving your browser.

Unix timestamp to date

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

Then format the cell as a date/time.
For milliseconds:      =A1/86400000 + DATE(1970,1,1)

Date to Unix timestamp

=(A1 - DATE(1970,1,1)) * 86400

For milliseconds:      =(A1 - DATE(1970,1,1)) * 86400000
Format the result cell as Number with 0 decimals.

Adjusting for a time zone

Add the offset in days. IST is UTC+5:30 = 5.5/24 days:

=A1/86400 + DATE(1970,1,1) + 5.5/24

Note this is a fixed offset — it will be an hour out across a
daylight saving boundary for zones that observe DST.

Google Sheets

=A1/86400 + DATE(1970,1,1)          same as Excel

Sheets always uses the 1899-12-30 origin, so the older
Mac 1904 date system is not a concern.

Pitfalls specific to Excel

  • Excel's origin is 30 December 1899, not 1 January 1900, because it deliberately reproduces a Lotus 1-2-3 bug that treated 1900 as a leap year.
  • Excel for Mac historically defaulted to a 1904 date system. A file moved between the two shifts every date by 1,462 days.
  • A formula result is a number until you format the cell as a date — a column of five-figure numbers means the format was never applied.

Rules that apply in every language

  1. Store UTC, display local. Keep the instant in UTC everywhere in your system and convert only at the point a human reads it.
  2. Name the unit in the identifier. expires_at_ms rather than expires_at costs nothing and prevents the single most common timestamp bug.
  3. Never trust a client clock. Stamp anything security-relevant on the server. See the note on clock skew.
  4. Use 64-bit time. Anything still storing seconds in a signed 32-bit field breaks in January 2038 — see the Year 2038 problem.

The same task in other languages

Frequently asked questions

How do I get the current Unix timestamp in Excel?

Use the snippet in the "Current Unix timestamp" section above. Excel & Google Sheets works in days since 1899-12-30 natively, so converting to another unit is a multiplication or an integer division away.

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

The "Timestamp to date" snippet above shows the idiomatic approach, including how to render the result in a specific time zone rather than whatever zone the machine happens to be set to.

Does Excel handle time zones and daylight saving correctly?

Yes, provided you pass an explicit zone rather than relying on the system default. The gotchas listed on this page cover the specific ways Excel & Google Sheets makes that easy to get wrong.