Python Forum
Adding times in ISO format?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding times in ISO format?
#1
I have a list of times in ISO format: HH:MM:SS representing the durations of various activities. I'd like to add them all. However, much as I've searched the documentation of datetime, I can't find how to do it. I can convert them to timedeltas, and add those to get a result in seconds - but surely there's a more direct way? I can also write my own program, but I would have thought that something so basic as adding times would be built in.

Anyway, any help or advice would be welcome! Thanks.

I've discovered, since I'm working with Pandas, that pandas.Timedelta does exactly what I want!
Reply
#2
FYI - If at some point you need it,
There's a good write-up on datetime here: https://pymotw.com/3/datetime/
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020