Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or
0
0
0
s2smodern

How to convert between date and Unix timestamp in Excel?

Unix timestamp is also called Epoch time or POSIX time which is wildly used in many operating systems or file formats. This tutorial is talking about the conversion between date and Unix timestamp in Excel.

Convert date to timestamp

Convert date and time to timestamp

Convert timestamp to date

Quickly remove time from date time formatting cells (1/20/2018 13:12:11 => 1/20/2018) in Excel

If you have a list of date time formatting cells, and you need to remove the time from the date time cells permanently and only keep the date format content in cells, for example, to remove 12:11:31 from 1/21/2017 12:11:31 and make it exactly 1/21/2017. How to quickly handle this job in Excel? With Kutools for Excel’s Commonly-used Formulas, you can quickly use the built-in formula to remove timestamp permanently from the date time formatting in Excel.  Click for 60 days free trial!
doc kte remove time from date
 
Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days.

arrow blue right bubble Convert date to timestamp


To convert date to timestamp, a formula can work it out.

Select a blank cell and type this formula =(A1-DATE(1970,1,1))*86400 into it and press Enter key, if you need, you can apply a range with this formula by dragging the autofill handle. Now a range of date cells have been converted to Unix timestamps.
doc-convert-date-unix-1


arrow blue right bubble Convert date and time to timestamp

There is a formula that can help you convert date and time to Unix timestamp.

1. Firstly, you need to type the Coordinated Universal Time into a cell, 1/1/1970. See screenshot:
doc-convert-date-unix-2

2. Then type this formula =(A1-$C$1)*86400 into a cell, press Enter key, then if you need, drag the autofill handle to a range with this formula. See screenshot:
doc-convert-date-unix-3

Tips: In the formula, A1 is the date and time cell, C1 is the coordinate universal time you typed.


arrow blue right bubble Convert timestamp to date

If you have a list of timestamp needed to convert to date, you can do as below steps:

1. In a blank cell next to your timestamp list and type this formula =(((A1/60)/60)/24)+DATE(1970,1,1), press Enter key, then drag the auto fill handle to a range you need.doc-convert-date-unix-4

2. Then right click the cells used the formula, and select Format Cells from the context menu, then in the popping Format Cells dialog, under Number tab, click Date in the Category list, then select the date type in the right section.
doc-convert-date-unix-5

3. Click OK, now you can see the Unix timestamps have been converted to dates.
doc-convert-date-unix-6

Tips:

1. A1 indicates the timestamp cell you need.

2. This formula also can use to convert timestamp series to date and time, just format the result to the date and time format.

Quickly and easily convert date to other data formatting in Excel

Have you ever tried to convert a date to day, month or year only? The formulas maybe hard to remember, but the Apply Date Formatting of Kutools for Excel can quickly convert a standard date to the date formatting as you need as below screenshot shown. Dont, waite, click for 60 days free trial!
doc apply date format
 
Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days.

Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
People in conversation:
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Myles F · 9 months ago
    One thing to note is that the above is for epoch time in seconds. If you need milliseconds, you need to add a further multiplication / division by 1000. For example, converting from epoch time (milliseconds) to a date would be "=((((A1/1000)/60)/60)/24)+DATE(1970,1,1)".
    • To post as a guest, your comment is unpublished.
      Myles F · 9 months ago
      As a side note, the best way to tell if it's seconds or milliseconds is looking at the length of the field; if it's 10 digits, it's seconds, and if it's 13 digits, it's milliseconds. "=LEN(A1)" will tell you how long the value is.
      • To post as a guest, your comment is unpublished.
        Myles F · 3 months ago
        If that's too much manual work for you (or you have a list that's mixed between seconds and milliseconds), then you can use the following formula to automatically switch between seconds and milliseconds based on the length of the cell: "=((A1/86400)/IF(LEN(A1)=13,1000,1))+DATE(1970,1,1)".
  • To post as a guest, your comment is unpublished.
    Lilian · 1 years ago
    I followed your instructions here, but I get ########## in my excel file. I formatted it to date time. Any suggestions?
    • To post as a guest, your comment is unpublished.
      Boe · 6 months ago
      Had the same problem, but I figured it out. The cell has to have number format, not date format...
    • To post as a guest, your comment is unpublished.
      fuad · 8 months ago
      yeah me too, I got the same problem
    • To post as a guest, your comment is unpublished.
      The Slenderman · 11 months ago
      Normally you see ########## if there's too much information to display for how big you have your cells. Enlarge your cell size and see if that resolves the issue.
    • To post as a guest, your comment is unpublished.
      Sunny · 11 months ago
      Excuse me, could you tell me which part did not work in your file? Could you upload the detail screenshot for me to have a look?
      • To post as a guest, your comment is unpublished.
        Scott Miller · 9 months ago
        Goggle for "excel convert timestamp to date". Google, grabbing the first answer which is for date to timestamp, gives the answer of "=(A1-DATE(1970,1,1))*86400", which is what Sunny was probably doing. Only if you actually read the content of this page does it become obvious that the actual formula should be something else. To keep the time portion of the timestamp, the formula should be this for UTC "=(A1+DATE(1970,1,1)*86400)/86400". For US Central time, "=(F2+DATE(1970,1,1)*86400-21600)/86400"
  • To post as a guest, your comment is unpublished.
    Andrey · 1 years ago
    Thank you!

    (Your comment is too short! - it was responce to my first line, so I just add this junk :P )
    • To post as a guest, your comment is unpublished.
      VAS · 8 months ago
      Using =(((((G2/1000)/60)/60)-8)/24)+DATE(1970,1,1) for PST