Guest User

Untitled

a guest
May 27th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #!/bin/python3
  2.  
  3. import os
  4. import sys
  5. from datetime import datetime
  6.  
  7. def tc1(s):
  8. if not s.endswith("PM"):
  9. return s[:8]
  10. else:
  11. return str(int(s[0:2]) + 12) + s[2:8]
  12.  
  13. def tc2(s):
  14. my_date = datetime.strptime(s, '%I:%M:%S%p')
  15. return my_date.strftime("%H:%M:%S")
  16.  
  17. s = "07:05:45PM"
  18. print(tc1(s))
  19. print(tc2(s))
Add Comment
Please, Sign In to add comment