Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Using re.match solution in Clear category for Time Converter (24h to 12h) by WreakHavoc
import re
def time_converter(time):
return time[1:] + ' a.m.' if re.match(r'0[1-9]:\d{2}', time) \
else '12:' + time[-2:] + ' a.m.' if re.match(r'00:\d{2}', time) \
else time + ' p.m.' if re.match(r'12:\d{2}', time)\
else str(int(time[:2]) - 12) + time[2:] + ' p.m.'
Jan. 10, 2020