Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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))
Add Comment
Please, Sign In to add comment