time = "2019-02-20T04:35:48.679000+00:00"
>>> import datetime
>>>
>>> date_time_str = "2019-02-20T04:35:48.679000+00:00"
>>> date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S.%f')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/_strptime.py", line 510, in _strptime_datetime
tt, fraction = _strptime(data_string, format)
File "/usr/lib/python3.5/_strptime.py", line 343, in _strptime
(data_string, format))
ValueError: time data '2019-02-20T04:35:48.679000+00:00' does not match format '%Y-%m-%d %H:%M:%S.%f'
The time is Django format time. Unfortunately i am storing the same in an CharField() so it is giving time as a string while fetching data from database.
How can i convert it into actual time.