Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First: datetime and strftime solution in Clear category for Time Converter (24h to 12h) by leggewie
import datetime as dt
def time_converter(time):
t = dt.time.fromisoformat(time)
ampm = " a.m." if t.hour<12 else " p.m."
return t.strftime("%I:%M").lstrip("0") + ampm
May 31, 2021