RDFLib/rdflib — Issue #112: DateTime literals with offsets fail to convert to Python
Author: gjhiggins
Created: 2012-02-20 08:33:02+00:00
State: closed

vfaronov, 2010-02-10T09:46:54.000Z

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

Comment 1 by gromgull
Applied patch in r1904 (but messed up commit message)