Second solution in Clear category for Time Converter (24h to 12h) by Vesagran
hour = int(time[:2])
ap = " a.m." if hour < 12 else " p.m."
hour = (hour - 1) % 12 + 1
return str(hour) + (time[2:]) + ap
April 3, 2019