The time duration is being described using four sets of double digits numbers separated with columns such as 00:02:01:16.
I know that this represents a time interval or a time duration.
I would like to translate it to a single number that represents a time duration in a more common form such as "120 seconds" or "12 minutes". What approach should be taken here?
-
Have you tried the things listed in this post? stackoverflow.com/questions/10663720/…jhack– jhack2016-10-13 22:29:19 +00:00Commented Oct 13, 2016 at 22:29
Add a comment
|
2 Answers
You need to use timedelta.
from datetime import timedelta
Assume your time 00:02:01:16 is stored in a, which comes from end_time - start_time
This will be automatically be a timedelta object. Then you can use a.total_seconds() to get the seconds information.
Check Timedelta Documentation for more usage and examples