Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Time Converter (12h to 24h) by hidebehind3
def time_converter(time):
time_, period = time.split()
hour, minute = (int(x) for x in time_.split(':'))
if period == 'p.m.':
if hour < 12:
hour += 12
elif hour > 12:
hour -= 12
elif hour == 12:
hour = 0
return '{:0>2}:{:0>2}'.format(hour, minute)
Oct. 30, 2018
Comments: