I need to convert a set of strings that is in this format "2017-12-02 23:55:66.333+01:00" to datetime.
I tried using this:
from datetime import datetime
date_time_str = '2017-12-02 23:55:66.333+01:00'
date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S%z')
print ("The date is", date_time_obj)
But i have this output:
>> ValueError: raise ValueError("time data %r does not match format %r" %
ValueError: time data '2017-12-02 23:55:66.333+01:00' does not match format '%Y-%m-%d %H:%M:%S%z'
How can i convert this date or this date_time_str is not valid?