My string is ,
str='2014-09-24T15:18:57+0000'
and I am trying to convert this string to valid datetime object. How to do that ?
What I tried is ,
>>> from datetime import datetime
>>> datetime.strptime(str,'%Y-%m-%dT%H:%M:%S')
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
datetime.strptime(str,'%Y-%m-%dT%H:%M:%S')
File "C:\Python27\lib\_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: +0000
But When I tried to change string to str='2014-09-24T15:18:57'
it works fine,
>>> datetime.strptime('2014-09-24T15:18:57','%Y-%m-%dT%H:%M:%S')
datetime.datetime(2014, 9, 24, 15, 18, 57)
Whats wrong with +0000
, How to avoid first error ?