Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
using time module solution in Clear category for Time Converter (24h to 12h) by ann3leo
def time_converter(input_time):
"""
- make time object from input string
- make string in 12 hours format
- deal with non-zero padded and replace AM/PM -> a.m./p.m.
"""
import time
time_struct = time.strptime(input_time, '%H:%M')
time_12 = time.strftime('%I:%M %p', time_struct)
return time_12.lstrip('0').lower().replace('m', '.m.')
Nov. 3, 2020
Comments: