0

I have some GMT times I need to convert to MDT, but the format is a bit odd compared to examples i've seen here and on other pages;
What is the "+00:00" on the end of these times? and how do I add formatting for it in my strptime statement?

examples:

2014-03-11T15:57:35+00:00
2014-03-12T22:54:16+00:00
2014-03-11T15:18:20+00:00

my current code:

t = datetime.strptime(str(answer[0][0].extendedField[item].value[0][0]), '%Y-%m-%dT%H:%M:%S')

the error:

Traceback (most recent call last):
  File "./myscript.py", line 79, in <module>
    query_scr(scr)
  File "./myscript.py", line 56, in query_scr
    t = datetime.strptime(str(answer[0][0].extendedField[item].value[0][0]), '%Y-%m-%dT%H:%M:%S')
  File "/usr/lib/python2.6/_strptime.py", line 328, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains: +00:00
Radamand
  • 175
  • 1
  • 12

0 Answers0