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

Terry Reedy tjreedy at udel.edu
Thu Sep 6 22:12:35 EDT 2012


On 9/6/2012 3:44 PM, Thomas Jollans wrote:
> On 09/06/2012 09:27 PM, John Nagle wrote:
>> In Python 2.7:
>>
>>     I want to parse standard ISO date/time strings such as
>>
>> 	2012-09-09T18:00:00-07:00
>>
>> into Python "datetime" objects.  The "datetime" object offers
>> an output method , datetimeobj.isoformat(), but not an input
>> parser.  There ought to be
>>
>> 	classmethod datetime.fromisoformat(s)
>
> http://docs.python.org/library/datetime.html#datetime.datetime.strptime
>
> The ISO date/time format is dead simple and well-defined. strptime is
> quite suitable.

I do not see any example formats. An example for ISO might be a good one.

-- 
Terry Jan Reedy




More information about the Python-list mailing list