I\'m trying to convert times from 12 hour times into 24 hour times...
06:35 ## Morning
11:35 ## Morning (If m2 is anywhe
If date is in this format (HH:MM:SSPM/AM) the following code is effective :
a=''
def timeConversion(s):
if s[-2:] == "AM" :
if s[:2] == '12':
a = str('00' + s[2:8])
else:
a = s[:-2]
else:
if s[:2] == '12':
a = s[:-2]
else:
a = str(int(s[:2]) + 12) + s[2:8]
return a
s = '11:05:45AM'
result = timeConversion(s)
print(result)