Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
strptime and strftime| solution in Clear category for Time Converter (12h to 24h) by mplichta
from datetime import datetime
def time_converter(time):
if 'p.m.' in time:
time = time.replace('p.m.', 'PM')
else:
time = time.replace('a.m.', 'AM')
return datetime.strptime(time, '%I:%M %p').strftime('%H:%M')
May 30, 2018