How to parse ISO formatted date in python?

Posted by Big 40wt Svetlyak on Stack Overflow See other posts from Stack Overflow or by Big 40wt Svetlyak
Published on 2008-09-24T15:17:00Z Indexed on 2010/03/23 1:01 UTC
Read the original article Hit count: 383

Filed under:
|
|

I need to parse strings like that "2008-09-03T20:56:35.450686Z" into the python's datetime?

I have found only strptime in the python 2.5 std lib, but it not so convinient.

Which is the best way to do that?

Update:

It seems, that python-dateutil works very well. I have found that solution:

d1 = '2008-09-03T20:56:35.450686Z'
d2 = dateutil.parser.parse(d1)
d3 = d2.astimezone(dateutil.tx.tzutc())

© Stack Overflow or respective owner

Related posts about python

Related posts about parsing