How to convert AM/PM timestmap into 24hs format in Python?
This approach uses strptime and strftime with format directives as per https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior, %H is the 24 hour clock, %I is the 12 hour clock and when using the 12 hour clock, %p qualifies if it is AM or PM. >>> from datetime import datetime >>> m2 = ‘1:35 PM’ >>> in_time = datetime.strptime(m2, “%I:%M %p”) … Read more