View Full Version : Adding hours:minutes:seconds


nelslynn
12-29-2002, 12:36 AM
I have a query that has provided the lapse time between two time periods... i.e. the time between 5:00:10 AM and 6:00:00 AM is 00:59:50. I have 10 lapse times that I need to add.

FOR EXAMPLE: The result of my query is:

-----s1------------s2------------s3-------------s4 ..... s10

00:59:10------1:20:50------1:00:00------00:59:00 ..... 1:00:00

the lapse times are in a date/time format 'hh:nn:ss'.

How do I get a result of 5:19:00 for the above example??

Thanks,

DES
12-29-2002, 06:42 AM
Total:[s1]+[s2]+ etc.... as a new field in the query

nelslynn
12-29-2002, 09:54 AM
I get 00:59:1001:20:5001:00:00...etc. It concatenates the values like a string.

Just some for information.... To arrive at the lapse time in the query I'm using: s1: (DateDiff("n",[01STRT],[02GLK])\60) & ":" & Format((DateDiff("n",[01STRT],[02GLK]) Mod 60),"00") & ":" & Format((DateDiff("s",[01STRT],[02GLK]) Mod 60),"00")

I guess this is producing a string data type. How do I convert it back to a Date data type??

Thanks for your help.

Jack Cowley
12-29-2002, 11:05 AM
Take a look at this article (http://support.microsoft.com/default.aspx?scid=kb;en-us;210604) on how to add time in Access...

hth,
Jack

Jon K
12-29-2002, 04:39 PM
Use the CDate() function to convert to date/time data type:-

Total: CDate([s1])+CDate([s2])+ ... etc


Note. It won't work if Total exceeds 23:59:59