ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calculate/concert long/integer to date time (https://www.excelbanter.com/excel-programming/278908-calculate-concert-long-integer-date-time.html)

Yejeet

calculate/concert long/integer to date time
 
Does anyone know how to calculate/convert a long/integer number (in seconds
from 01-01-1970 00:00:00) to a readable date-time format in excel.

Thanks.

-=[ Yajeet ]=-



John Green[_2_]

calculate/concert long/integer to date time
 
If you are talking about a spreadsheet formula where your lonng integer is in A1:

=DATE(1970,1,1)+A1/(24*60*60)

If you want a VBA formula where your long integer is in X

myDate = DateSerial(1970,1,1)+X/(24*60*60)

Excel holds dates as whole days plus time as a decimal value, so you can convert seconds to days by dividing by the number of
seconds in a day.

--

John Green - Excel MVP
Sydney
Australia


"Yejeet" wrote in message ...
Does anyone know how to calculate/convert a long/integer number (in seconds
from 01-01-1970 00:00:00) to a readable date-time format in excel.

Thanks.

-=[ Yajeet ]=-





Yajeet

calculate/concert long/integer to date time
 
Thank you John :)

The formula that worked for me was: =DATUM(1970;1;1)+A1/(24*60*60)
I didn't know that XL functions are language dependend.
FYI: I work with a Dutch version of XL.

Do you, by any chance, know what would happen when this - Dutch - worksheet
would be opened with a - say - English version of XL ?
I figure that the formula would be invalid ? Or not ? Can one avoid such a
situation ?

Thank you for your time.

-=[ Yajeet ]=-

"John Green" schreef in bericht
...
If you are talking about a spreadsheet formula where your lonng integer is

in A1:

=DATE(1970,1,1)+A1/(24*60*60)

If you want a VBA formula where your long integer is in X

myDate = DateSerial(1970,1,1)+X/(24*60*60)

Excel holds dates as whole days plus time as a decimal value, so you can

convert seconds to days by dividing by the number of
seconds in a day.

--

John Green - Excel MVP
Sydney
Australia





All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com