Last active
May 23, 2018 13:03
-
-
Save dalinaum/3ac1065bb3e3f178d442573fd31f0169 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/python3 | |
import os | |
import sys | |
from datetime import datetime | |
def tc1(s): | |
if not s.endswith("PM"): | |
return s[:8] | |
else: | |
return str(int(s[0:2]) + 12) + s[2:8] | |
def tc2(s): | |
my_date = datetime.strptime(s, '%I:%M:%S%p') | |
return my_date.strftime("%H:%M:%S") | |
s = "07:05:45PM" | |
print(tc1(s)) | |
print(tc2(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment