ValueError when using strptime to get a datetime object

Viewed 43801

Im trying to convert a date string to a datetime object as shown below :

dt = datetime.datetime.strptime('2011-07-15 13:00:00+00:00', '%Y-%m-%d %H:%M:%S')

But,im getting the error below :

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/_strptime.py", line 328, in _strptime data_string[found.end():]) ValueError: unconverted data remains: +00:00

I guess there is a problem with my format string. How to fix that ?

Thank You

3 Answers
Related