Parsing ISO date/time strings - where did the parser go?

Pete Forman petef4+usenet at gmail.com
Wed Sep 12 08:31:14 EDT 2012


John Nagle <nagle at animats.com> writes:

>    I want to parse standard ISO date/time strings such as
>
> 	2012-09-09T18:00:00-07:00
>
> into Python "datetime" objects.

Consider whether RFC 3339 might be a more suitable format.

It is a subset of ISO 8601 extended format.  Some of the restrictions are

  Year must be 4 digits
  Fraction separator is period, not comma
  All components including time-offset are mandatory, except for time-secfrac
  time-minute in time-offset is not optional, must use ±hh:mm or Z

Some latitude is allowed

  T may be replaced by e.g. space

Extra feature

  time-offset of -00:00 means UTC but local time is unknown

-- 
Pete Forman



More information about the Python-list mailing list