This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nagle
Recipients nagle
Date 2012-09-06.21:08:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The datetime module has support for output to a string of dates and times in ISO 8601 format ("2012-09-09T18:00:00-07:00"), with the object method "isoformat([sep])".  But there's no support for parsing such strings.  A string to datetime class method should be provided, one capable of parsing at least the RFC 3339 subset of ISO 8601.

The problem is parsing time zone information correctly.
The allowed formats for time zone are
   empty       - no TZ, date/time is "naive" in the datetime sense
   Z           - zero, or Zulu time, i.e. UTC.
   [+-]nn.nn   - offset from UTC
"strptime" does not understand timezone offsets. The "datetime" documentation suggests that the "z" format directive handles time zone info, but that's not actually implemented for input.  

Pypi has four modules for parsing ISO 8601 dates. Each has least one major
problem in time zone handling:

iso8601 0.1.4 		
   Abandonware.  Mishandles time zone when time zone is "Z" and
   the default time zone is specified. 0.1dev 	
   Always returns a "naive" datetime object, even if zone specified.
iso8601plus 0.1.6 	
   Fork of abandonware version above.  Same bug.
zc.iso8601 0.2.0
   Zope version.  Imports the pytz module with the full Olsen time zone
   database, but doesn't actually use that database.

Thus, nothing in Pypi provides a good alternative. 

It would be appropriate to handle this in the datetime module.  One small, correct, tested function would be better than the existing five bad alternatives.
Date User Action Args
2012-09-06 21:08:50naglesetrecipients: + nagle
2012-09-06 21:08:50naglesetmessageid: <>
2012-09-06 21:08:49naglelinkissue15873 messages
2012-09-06 21:08:48naglecreate