Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Time Converter (12h to 24h) by tokiojapan55
import re
def time_converter(time):
match = re.match('^(\d+):(\d+)\s+([p|a])\.m\.$', time)
if match:
h,m,x = int(match.group(1)),int(match.group(2)),match.group(3)
if h<12 and x=='p':
h += 12
elif h==12 and x=='a':
h = 0
return "{:02}:{:02}".format(h,m)
return None
June 22, 2020
Comments: