I\'m trying to convert times from 12 hour times into 24 hour times...
06:35 ## Morning
11:35 ## Morning (If m2 is anywhe
''' To check whether time is 'AM' or 'PM' and whether it starts with
12 (noon or morning). In case time is after 12 noon then we add
12 to it, else we let it remain as such. In case time is 12
something in the morning, we convert 12 to (00) '''
def timeConversion(s):
if s[-2:] == 'PM' and s[:2] != '12':
time = s.strip('PM')
conv_time = str(int(time[:2])+12)+time[2:]
elif s[-2:] == 'PM' and s[:2] == '12':
conv_time = s.strip('PM')
elif s[-2:] == 'AM' and s[:2] == '12':
time = s.strip('AM')
conv_time = '0'+str(int(time[:2])-12)+time[2:]
else:
conv_time = s.strip('AM')
return conv_time