Created
July 1, 2020 15:47
-
-
Save story645/b43217c5c0d96c7c07f69d1125330a13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def to24(time): | |
| try: | |
| hour, minute, local = time.split(":") | |
| except (ValueError, AttributeError): | |
| return time | |
| h = int(hour) | |
| m = int(minute) | |
| if time.endswith('AM'): | |
| if h == 12: | |
| h = 0 | |
| timeo = h*100 + m | |
| elif time.endswith('PM'): | |
| timeo = (h+12) * 100 + m | |
| return timeo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment