How do I convert a Unix epoch timestamp into a human readable date/time in Excel?

后端 未结 6 657
余生分开走
余生分开走 2021-01-30 13:23

I have Excel documents containing Unix epoch timestamps from a Java application. I\'d like to see what they translate to and represent them as human readable dates inside of Exc

6条回答
  •  不思量自难忘°
    2021-01-30 13:44

    I have found that the easiest formulas to remember and read are these:

    Convert from Unix/Epoch timestamp to date in Excel (assuming timestamp is in A2):

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

    This will generate the GMT Excel time value. You then need to set the format for the cell to one of the date formats, or create your own custom format. I tend to use either:

    dd-mmm-yy                --> gives 05-Oct-18
    dd-mmm-yyyy hh:mm:ss     --> gives 05-Oct-2018 09:45:12
    

    Convert from date to Epoch timestamp (assuming date is in A2):

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

    I have found that this page is pretty helpful: Extendoffice excel-timestamp-to-date

    Note: If you need to adjust to local time from GMT (New York as an example), add the difference at the end. The following show a -5 hour offset.

    =(A2/86400)+DATE(1970,1,1)+(-5/24)
    

提交回复
热议问题