'How to convert Text 25:40:45 to 1:40:45 (24 hours format) in Python
Solution 1:[1]
This should work. It splits the string on :, gets the remainder of the hour divided by twenty four then joins the string back together and returns it.
def modulo24(start_time):
hour, minute, second = start_time.split(':')
hour = str(int(hour) % 24)
clean_start_time = ":".join([hour, minute, second])
return clean_start_time
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nathan Mills |

