Converting normal time to Epoch time format using excel

Colombo

Board Regular
Joined
Apr 21, 2003
Messages
54
I'm working on converting some databases. One has entries with normal human readable time format, the other uses the unix epoch time format.

Is there a function or vba code that I can use in excel to convert the normal time format to epoch time?

I've got a thousand or so entries, so it would be nice to find a way to do this on a large scale.

Thanks

Josh
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,940
Hello,

I think I'm correct in saying that UNIX time is the number of seconds that has elapsed since 1/1/1970. Excel calculates dates by using the number of days that has elapsed since 1/1/1900. Therefore you should be able to convert from one to the other by converting from seconds to days, and then adding on the 70 odd years difference.

The formula :- =(A1/86400)+25569 where A1 contains the UNIX time should convert to Excel date/time. Make sure you format the cell as the required date/time format.
 

Colombo

Board Regular
Joined
Apr 21, 2003
Messages
54
That does seem to work to go from epoch to normal time, but what I really need is to go from normal time to epoch time.

Like you said, since the excel time function goes from 1/1/1900 I assume you'd be able to rig something......
 

Colombo

Board Regular
Joined
Apr 21, 2003
Messages
54
That seems to work :)

Thanks

Josh
 

sweetlb

New Member
Joined
Oct 9, 2006
Messages
12
How can I use this formula (=(A1/86400)+25569) but account for my time zone?
IE: I enter decimal time of 1213636585 and the formula gives me "6/16/2008 17:16:25" which is GMT, but my server is in EST, so I want it to read 6/16/2008 13:16:25".

I also need to account for all four US time zones.

Thanks
Brian
 

maxdog0099

New Member
Joined
Mar 19, 2010
Messages
4
I'm attempting the same epoch conversion in Excel 2007 but the result is nothng but tons of # signs in the cell. For the cell format I've tried mm/dd/yyyy hh:mm along with just about all others and the same result happens. What am I doing wrong here?
 

dvenus

New Member
Joined
Jul 1, 2009
Messages
2
Hi!

Not sure this is your problem but make sure your Excel column is wide enough. You can either double click on the column seperator or drag it.

Dave Venus
 

maxdog0099

New Member
Joined
Mar 19, 2010
Messages
4
Thanks. I've tried adjusting the column width which makes no difference. I can make it as wide as I want and still filled with all ## symbols.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,291
Messages
5,485,973
Members
407,523
Latest member
Talicius

This Week's Hot Topics

Top