gjhiggins/rdflib — Issue #117: DateTime literals with offsets fail to convert to Python
Author: gjhiggins
Created: 2011-10-19 01:25:57+00:00
State: closed

Originally filed by vfaronov on 2010-02-10T09:46:54

Literal.toPython() returns self if the literal is an xsd:dateTime with a
UTC offset specified, like this: 2010-02-10T12:36:00+03:00.

Handling timezones isn't straightforward, but there's a short (~100 lines)
module called iso8601[1] that can convert such values (more or less)
properly, including timezone info. It's MIT licensed. Perhaps it could be
included in the distribution, and _strToDateTime() made to use it?

[1] http://code.google.com/p/pyiso8601/source/browse/trunk/iso8601/iso8601.py