PY
py
1
2
3
4
5
6
7
8
9
10
11
conv_time_AM= {1:'01',2:'02', 3:'03', 4:'04', 5:'05', 6:'06', 7:'07', 8:'08', 9:'09', 10:'10', 11:'11', 12:'12'}
conv_time_PM= {1:'13',2:'14', 3:'15', 4:'16', 5:'17', 6:'18', 7:'19', 8:'20', 9:'21', 10:'22', 11:'23', 12:'00'}
inp_time ='12:15 PM' #inp_time ='1:15 AM'
hour_minute = inp_time.split (sep=':')
am_pm_minute = list(hour_minute[1].split(sep=' '))
if am_pm_minute[1] == 'AM':
am_time ='{0}:{1}'.format(conv_time_AM.get(int(hour_minute[0])), am_pm_minute[0])
print(am_time)
elif am_pm_minute[1] == 'PM':
pm_time ='{0}:{1}'.format(conv_time_PM.get(int(hour_minute[0])),am_pm_minute[0])
print(pm_time)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run