Excel time to Access time

lite4d

Registered User.
Local time
Today, 07:49
Joined
Apr 2, 2014
Messages
27
I have an Excel spreadsheet that I import to Access 2010 that I cannot seem to get the times to convert. The times are listed as below:

EXCEL
dd:hh:mm:ss which gives me 05:20:52:19
hh:mm:ss@ which gives me 140:52:19

I could use either format but whn I import the 140:52:19 it loses the 5 days.

Neither will convert right to Access. What formula do I need to use to get this to convert right. I have been trying everything.

Thanks for the help!

Chris
 
pls. clarify again

u may send screenshot of excel and access workspace
 
whn I import the 140:52:19 it loses the 5 days

Did you actually check the date element of the datetime variable?
 
Here are the screen shots.
 

Attachments

  • access.jpg
    access.jpg
    98.5 KB · Views: 108
  • excel.jpg
    excel.jpg
    101.1 KB · Views: 95
Did you actually check the date element of the datetime variable?

I tried everyway with the formatting in Excel but i can't get Access to show it the same way. Check the screen shots above.
 
Just an FYI: http://chandoo.org/wp/2011/05/16/lost-excel-functions/

Not sure what formula's are being used in your screen shot.
This might be an approach worth considering.
For time elasped - caculate it into parts of a day. Then perform the caculation on it.
example:
2/2/2000 Noon until 2/3/2000 6PM time elasped is 1.25000000
The 1.25 is equal to 1 day (24 hours) and a quarter of a day (6 hours).
now on the Excel side, this number, probably with different format or different formulas can be converted to days, hours, minutes, seconds.
 
Not sure what formula's are being used in your screen shot.
This might be an approach worth considering.
For time elasped - caculate it into parts of a day. Then perform the caculation on it.
example:
2/2/2000 Noon until 2/3/2000 6PM time elasped is 1.25000000
The 1.25 is equal to 1 day (24 hours) and a quarter of a day (6 hours).
now on the Excel side, this number, probably with different format or different formulas can be converted to days, hours, minutes, seconds.

I got the formula to calculate the time between the dates but i can't seem to get the right formula to convert over to Access from Excel. How do I need to format the cells to get them to convert properly? If I try to make them DD:HH:MM:SS in Excel, it won't convert the days over. It gives me the MM/DD/YY then the time(ie 01/02/1900 23:22:19). I have a feeling it's just getting the right format in Access but I am not sure what theat formula is.
 
in access, the "number" represents the number of days since 30-12-1899 (dont ask me why)
Thus 0 is equal to 30-12-1899
1 = 31-12-1899
2 = 1-jan-1900
3 = 2-jan-1900

Unfortuntaly access does only support the 24 hour clock, which in part is causing this problem. The data though is there, though if you format it to only show the time yes you lose it.... And no you cant really "fix it" unless you do it in a query.
 
in access, the "number" represents the number of days since 30-12-1899 (dont ask me why)
Thus 0 is equal to 30-12-1899
1 = 31-12-1899
2 = 1-jan-1900
3 = 2-jan-1900

Unfortuntaly access does only support the 24 hour clock, which in part is causing this problem. The data though is there, though if you format it to only show the time yes you lose it.... And no you cant really "fix it" unless you do it in a query.

Ok. Well that makes me feel better that I wasn't going crazy. I'll try to get the data to calculate in a query after I import into Access. Thanks for the sanity check.

Chris
 
The trick for this is that you have to realize that time in Access or Excel doesn't exist as a data type, only as a reformatting of another number type.

In Access, time is a reformatted DOUBLE (floating-point or real) number. In Excel, anything that isn't text or a linked/embedded object is a number. You run into a couple of nasties that make your life trickier, but there is some hope. In general, the concept is that time is treated as a number of days and fractions thereof since a reference date.

First nasty: Access and Excel don't use the same reference date.

If you are doing elapsed-time computations, taking the difference between two times in the internal (DOUBLE) format works just fine. The problem occurs not when you do time diddling and manipulation, but rather when you try to reformat the time.

Second nasty: If you are doing differences between two times, both must be derived from Excel or both must be from Access because...

Third nasty: If at any point you have converted one of those "binary" times from Excel to text and later convert it back under Access, you implicitly changed the reference date.

Now, for Access versions at/after 2007, I believe there is a time format hhh:nn:ss that lets you specify a number of hours beyond 23. However, to really manipulate times that would have a days:hours:minutes:seconds format, you might need to "roll your own" function to do the formatting. I don't know if Excel at/after 2007 supports that same specification.

In summary, the trick is to keep the dates numeric as long as possible and only convert to dates when you absolutely have to do so.
 
The trick for this is that you have to realize that time in Access or Excel doesn't exist as a data type, only as a reformatting of another number type.

In Access, time is a reformatted DOUBLE (floating-point or real) number. In Excel, anything that isn't text or a linked/embedded object is a number. You run into a couple of nasties that make your life trickier, but there is some hope. In general, the concept is that time is treated as a number of days and fractions thereof since a reference date.

First nasty: Access and Excel don't use the same reference date.

If you are doing elapsed-time computations, taking the difference between two times in the internal (DOUBLE) format works just fine. The problem occurs not when you do time diddling and manipulation, but rather when you try to reformat the time.

Second nasty: If you are doing differences between two times, both must be derived from Excel or both must be from Access because...

Third nasty: If at any point you have converted one of those "binary" times from Excel to text and later convert it back under Access, you implicitly changed the reference date.

Now, for Access versions at/after 2007, I believe there is a time format hhh:nn:ss that lets you specify a number of hours beyond 23. However, to really manipulate times that would have a days:hours:minutes:seconds format, you might need to "roll your own" function to do the formatting. I don't know if Excel at/after 2007 supports that same specification.

In summary, the trick is to keep the dates numeric as long as possible and only convert to dates when you absolutely have to do so.


Yeah I tried to use the same format from Excel to Access but that didn't work and now I know why. I ended up using Access to calculate the time vice Excel. When I down load the file to Excel the calculations are already done which is why I was trying to use them instead of reinventing the wheel so to speak.
 

Users who are viewing this thread

Back
Top Bottom