Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Trivial Decision solution in Clear category for Time Converter (24h to 12h) by Georgie
def time_converter(time):
time = time.split(':')
if 0 <= int(time[0]) <= 12 or time[0] == '24':
if time[0] == '00' or time[0] == '24':
return '12:%s a.m.'%time[1]
elif time[0] == '12':
return '12:%s p.m.'%time[1]
return '%d:%s a.m.'%(int(time[0]), time[1])
return '%d:%s p.m.'%(int(time[0]) - 12, time[1])
Dec. 30, 2019