Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Time 1

Status
Not open for further replies.

JaeBrett

Programmer
May 5, 2003
196
0
0
CN
I have an Access table with field1, field2, field3, field4 that have times like "13:41" or "1:34" or so on. I need to get the total amount of time for all of those fields.

Can I do this via SQL or is there somehow to do it in VB?

<-- JaeTech Solutions -->
 
Are these datetimes?
if so you should be able to just sum the fields.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
But can I get the sum of fields that are in Date/Time format?
How...?

<-- JaeTech Solutions -->
 
DateTime types are stored as Doubles, where the Integer part is the days since Dec 30th 1899 and the fractional part is the fraction of a day since midnight.

[tt]myTime - Int(myTime)[/tt]
gives the fractional part of each value. Add these to get a total. Then
[tt]Int(myTotal) [/tt]
gives the days in the total and
[tt]Format(myTotal,"hh:mm:ss") [/tt]
will give the hours, minutes and seconds in your total.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top