How to calculate the time interval between two time strings

I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I’ve been looking through documentation for Python and searching online and I would imagine it would have something to do with the datetime and/or time modules. I can’t get it to work properly and keep finding only how to do this when a date is involved.

Ultimately, I need to calculate the averages of multiple time durations. I got the time differences to work and I’m storing them in a list. I now need to calculate the average. I’m using regular expressions to parse out the original times and then doing the differences.

For the averaging, should I convert to seconds and then average?

15 Answers
15

Leave a Comment