I am trying to obtain the time in the following way using this Python code:
from datetime import datetime
start_time="2021-07-31 09:43:23 IST"
# convert time string to datetime
t1 = datetime.strptime(start_time,"%Y-%m-%d %H:%M:%S %Z")
print('Start time:', t1.time())
But I get an error:
ValueError: time data '2021-07-31 09:43:23 IST' does not match format '%Y-%m-%d %H:%M:%S %Z'
How should I resolve it, as the time dataset contains "IST"
and %Z
is not working for it.