First: datetime and strftime solution in Clear category for Time Converter (24h to 12h) by leggewie
import datetime as dt
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