Need to add HH:MM:SS:MS
Need to add HH:MM:SS:MS
(OP)
Hi,
Does anybody knows how to add times in Python?
Need to add HH:MM:SS:MS
The file goes like this:
5/1/2020 2:40:31 PM, 5/1/2020 2:43:11 PM, 00:02:40.5449136,
5/1/2020 2:45:26 PM, 5/1/2020 2:48:17 PM, 00:02:50.8250927,
the third column is a timduration, need to sum it up.
Thank you.
Does anybody knows how to add times in Python?
Need to add HH:MM:SS:MS
The file goes like this:
5/1/2020 2:40:31 PM, 5/1/2020 2:43:11 PM, 00:02:40.5449136,
5/1/2020 2:45:26 PM, 5/1/2020 2:48:17 PM, 00:02:50.8250927,
the third column is a timduration, need to sum it up.
Thank you.
RE: Need to add HH:MM:SS:MS
Fortunately Python has a dedicated timedelta class for that purpose ( just like Java has Period and PHP has DateInterval ). That makes calculations simple ( and with Python's overloaded operators also intuitive ).
Unfortunately timedelta has no dedicated method to initialize it from a string, like datetime's .strptime(), so you have to spoonfeed it with integers :
CODE --> Python
Feherke.
feherke.github.io
RE: Need to add HH:MM:SS:MS