I need some help with my python code, I have a string in the object that I am comparing with the variable that I created to get the 24 hours time. Now I want to converts the time from 24 hours to 12 hours under the if statement.
Here is the strings:
17:56:26 T:4692 NOTICE: 18:00
17:56:26 T:4692 NOTICE: 18:00
17:56:26 T:4692 NOTICE: 18:00
17:56:26 T:4692 NOTICE: 18:00
17:56:26 T:4692 NOTICE: 18:00
17:56:26 T:4692 NOTICE: 18:00
Output:
17:56:26 T:4692 NOTICE: 6:00
17:56:26 T:4692 NOTICE: 6:00
17:56:26 T:4692 NOTICE: 6:00
17:56:26 T:4692 NOTICE: 6:00
17:56:26 T:4692 NOTICE: 6:00
17:56:26 T:4692 NOTICE: 6:00
Here is the code:
get_stop_time = time.strptime(stop_date, '%Y%m%d%H%M%S')
stop_time = time.strftime('%H:%M', get_stop_time)
if start_time <> current_time < stop_time:
print "stop_time"
print stop_time
#NOW LET CONVERTS TIME TIME FROM 24 HOURS TO 12 HOURS FOR THE STOP_TIME
Can you please show me an example how I could converts the time from the 24 hours to 12 hours using the strings?
What I should use to converts it?