January 4, 2012 at 9:51 am
Ok, sorry for the dumb question but I am stumped as the best way to add up a bunch of hh:mm::ss data. My data looks like this:
User Start End Duration
3712011-12-02 21:36:18.0002011-12-03 04:55:20.00007:19:02
3712011-12-03 04:56:14.0002011-12-03 08:40:19.00003:44:05
3712011-12-03 21:31:32.0002011-12-03 21:48:31.0000:16:59
3712011-12-03 21:48:38.0002011-12-04 02:44:46.00004:56:08
3712011-12-04 02:52:43.0002011-12-04 08:02:18.00005:09:35
3712011-12-04 21:31:20.0002011-12-05 07:35:59.00010:04:39
3712011-12-08 13:30:38.0002011-12-08 15:19:57.00001:49:19
3712011-12-08 15:32:54.0002011-12-08 16:32:53.0000:59:59
3712011-12-08 16:40:16.0002011-12-08 17:45:19.00001:05:03
3712011-12-08 18:16:32.0002011-12-08 21:40:59.00003:24:27
I need to sum up all of the duration to display total HH:MM:SS.
Thanks
January 4, 2012 at 9:57 am
Multiply the hours duration by 3600, the minutes duration by 60. Total those up with the seconds, and you have a total seconds of duration. Even easier, skip that step and just use DateDiff(second) on the start and end times.
Then just sum up the seconds. Divide by 3600 to get hours, divide the modulus of that by 60 to get minutes, and the mod of that is seconds.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply