Converting unix timestamp to excel date-time...

dhcrusoe

New Member
Joined
Jan 10, 2005
Messages
11
Hey all,

This is a relatively simple problem, I think, but it's driving me crazy. I'm analyzing 13.8 million rows of data (participant observation in an educational MUVE) and need to convert the unix timestamp to a date/time.

I know that, for example:

Unix stamp: 1096405159
converts to: Thu 10/07/04 sometime around 9.00 am...

but my formula:

=(F2+((365*70+19)*86400))/86400-0.41667 isn't working right... any suggestions?

Thanks!

--dave
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This is a tough one chap.

Just as a pointer and you have probably already thought of this - Don't forget to acocunt for:

1. Leap years
2. Geographical time zones
3. Day light saving

In total these factors could account for upto a 10 day error!

I would love to know the solution! Sorry I cannot be of more help!

Andrew
 
Upvote 0
Hi Dave:

The HTML post I have above doesn't look too cool. So let me try again ...

ExcelTime is = UnixTime + ("1/1/1970"-"1/1/1900"+1)*86400

and then I formated the resulting entry as mmm-dd-yyyy hh:mm:ss

I hope this helps!
 
Upvote 0
Yogi,

Shouldn't the equation be:

ExcelTime is = (UnixTime + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400

Regards

Andrew
 
Upvote 0
Hi Andrew:

Yes Sir -- sorry for the editorial oversight ... the equation should correctly read ...

ExcelTime is = (UnixTime + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400
 
Upvote 0
Thanks!

Thanks! Everything works, though I had to subtract ~4 hours from the result to match the Unix code...
 
Upvote 0
Hi Andrew:

Yes Sir -- sorry for the editorial oversight ... the equation should correctly read ...

ExcelTime is = (UnixTime + ("1/1/1970"-"1/1/1900"+1)*86400) / 86400

Yes, that's perfect if you live on the Greenwich Mean Time Line...

To add GMT offset, timezone is required in the formula:
=(D17591 + ("1/1/1970"-"1/1/1900"+1)*86400 +36000) / 86400
=(M$_XL_Cell_Value + ("1/1/1970"-"1/1/1900"+1)*86400 + GMT_Offset) / 86400
36000 = GMT+10
Aussie Aussie Aussie, Oi Oi Oi!
:laugh:
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top