[Python-ideas] Parsing ISO 8601 with the standard library

random832 at fastmail.us random832 at fastmail.us
Tue Mar 11 20:14:22 CET 2014


On Tue, Mar 11, 2014, at 14:46, Tin Tvrtković wrote:
> '1997-07-16T19:20:30.45+01:00' is a valid ISO 8601 date and time 
> representation, the likes of which can be generated by the datetime 
> module itself (the isoformat method). The %z strftime directive only 
> recognizes offsets without the semicolon. The Python docs also direct 
> users to inspect the platform strftime documentation; on my system the 
> man page clearly states %z is "... The +hhmm or -hhmm numeric timezone", 
> again, no semicolon support.

Maybe Python should switch to platform-independent time
parsing/formatting implementations. These can have a %z that accepts
this format.

I will incidentally note that as of SUSv7 systems are not required to
support %z for strptime at all (nor does it therefore impose any
requirement to reject formats including a colon, or 'Z'.)


More information about the Python-ideas mailing list