70

I have a very large excel spread sheet that has a column of time stamps. Does anyone know convert that over to a date? Is there a function I can use? I tried format cell date but that doesn't work. My file is 91,568 KB. If there is a simpler way to this that would be great. I'm open to ideas.

Thank you in advance :)

P.S. I don't know any programming languages

3
  • 1
    What kind of a timestamp is that? Milliseconds? Internet is full of answers. Did you try some of those? bajb.net/2010/05/excel-timestamp-to-date Apr 17, 2013 at 21:51
  • The time stamp looks like this 1234817823. When I use this website (onlineconversion.com/unix_time.htm) it says Mon, 16 Feb 2009 20:57:03 GMT. My problem is how to create a function that will apply to 1 million records.
    – user10165
    Apr 17, 2013 at 22:02
  • 1
    Then have a look at the link I've posted. I don't have excel, but I've tried that in Libreoffice Calc and the output is: 02/16/09 08:57 PM Apr 17, 2013 at 22:05

13 Answers 13

112

Use this formula and set formatting to the desired time format:

=(((COLUMN_ID_HERE/60)/60)/24)+DATE(1970,1,1)

Source: http://www.bajb.net/2010/05/excel-timestamp-to-date/ Tested in libreoffice

4
  • 3
    =INT(((COLUMN_ID_HERE/60)/60)/24)+DATE(1970,1,1) This works for me.. Also Note that the Timestamp should be in seconds
    – nischayn22
    Aug 10, 2016 at 14:32
  • If you are going to display the time value according to your timezone, you should add time offset +TIME(1,0,0)
    – Horsing
    Dec 9, 2020 at 5:56
  • =INT( ( ( COLUMN_ID / 60 ) / 60 ) / 24 ) + DATE( 1970; 1; 1 ) For Microsoft Excel Online Mar 10, 2022 at 23:36
  • The INT will round to the nearest day, that's probably not what the OP wanted.
    – MikeF
    May 10, 2023 at 16:48
41

A timestamp is the elapsed time since Epoch time (01/01/1970), so basically we have to convert this time in days, and add the epoch time, to get a valid format for any Excel like spreadsheet software.

  • From a timestamp in milliseconds (ex: 1488380243994)

    use this formula:

    =A1/1000/86400+25569
    

    with this formater:

    yyyy-mm-dd hh:mm:ss.000
    
  • From a timestamp in seconds (ex: 1488380243)

    use this formula:

    =A1/86400+25569
    

    with this formater:

    yyyy-mm-dd hh:mm:ss
    

Where A1 is your column identifier. Given custom formaters allow to not loose precision in displayed data, but you can of course use any other date/time one that corresponds to your needs.

2
  • Cool answer! Could you please explain why you add 25569 specifically? I know the result is correct, but I can't understand why you need to add that.
    – GigiSan
    Feb 16, 2022 at 14:23
  • 1
    Excel counts dates from 1900. 25569 is the number of days until 1/1/1970 when unix starts.
    – MikeF
    May 10, 2023 at 16:54
30

below formula worked form me in MS EXEL

=TEXT(CELL_VALUE/24/60/60/1000 + 25569,"YYYY-MM-DD HH:MM")

CELL_VALUE is timestamp in milliseconds

here is explanation for text function.

1
  • 2
    This worked for me as well, here's another example that does timezone correction if needed (example is for UTC-5): =TEXT((D3/60/60/1000 + 5)/24 + 25569,"YYYY-MM-DD HH:MM")
    – Jono
    Jun 4, 2021 at 17:48
22

If you get a Error 509 in Libre office you may replace , by ; in the DATE() function

=(((COLUMN_ID_HERE/60)/60)/24)+DATE(1970;1;1)
1
  • 6
    This may depend on the locales settings in your OS.
    – lorenz
    Oct 31, 2014 at 10:21
10

If your file is really big try to use following formula: =A1 / 86400 + 25569

A1 should be replaced to what your need. Should work faster than =(((COLUMN_ID_HERE/60)/60)/24)+DATE(1970,1,1) cause of less number of calculations needed.

1
  • This is a more elegant solution and also keeps the 'time' part of the timestamp (not just the date)
    – Patrick
    May 28, 2017 at 3:14
7
=(((A1/60)/60)/24)+DATE(1970,1,1)+(-5/24)

assuming A1 is the cell where your time stamp is located and dont forget to adjust to account for the time zone you are in (5 assuming you are on EST)

6

Be aware of number of digits in epoch time. Usually they are ten (1534936923) ,then use:

=(A1 / 86400) + 25569    

For thirteen digits (1534936923000) of epoch time adjust the formula:

=(LEFT(A1,LEN(A1)-3) / 86400) + 25569    

to avoid

###################################

Dates or times that are negative or too large display as ######

See more on https://www.epochconverter.com/

5

This DATE-thing won't work in all Excel-versions.

=CELL_ID/(60 * 60 * 24) + "1/1/1970"

is a save bet instead.
The quotes are necessary to prevent Excel from calculating the term.

1

The answer of @NeplatnyUdaj is right but consider that Excel want the function name in the set language, in my case German. Then you need to use "DATUM" instead of "DATE":

=(((COLUMN_ID_HERE/60)/60)/24)+DATUM(1970,1,1)
0

AD ticks to datetime format: =A1/864000000000 - 109205

0

i got result from this in LibreOffice Calc :

=DATE(1970,1,1)+Column_id_here/60/60/24

0

This worked for me:

=(col_name]/60/60/24)+(col_name-1)
-2

Use this simple formula. It works.

Suppose time stamp in A2:

=DATE(YEAR(A2),MONTH(A2),DAY(A2))
1
  • 1
    No, it does not work, unless the content of A2 is already a date rather than timestamp. Dec 22, 2021 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.