PEP 321: Date/Time Parsing and Formatting

Bengt Richter bokr at oz.net
Tue Nov 18 01:47:45 CET 2003


On Mon, 17 Nov 2003 17:59:24 -0500, "John Roth" <newsgroups at jhrothjr.com> wrote:

>
>"Gerrit Holl" <gerrit at nl.linux.org> wrote in message
>news:mailman.803.1069091744.702.python-list at python.org...
>> Hi,
>>
>> PEP 321 reads:
>> > Python 2.3 added a number of simple date and time types in the
>> > ``datetime`` module.  There's no support for parsing strings in various
>> > formats and returning a corresponding instance of one of the types.
>> > This PEP proposes adding a family of predefined parsing function for
>> > several commonly used date and time formats, and a facility for generic
>> > parsing.
>>
>> I was recently surprised by this fact. I don't know why there isn't
>> such a function/method. In my opinion, it isn't a question of whether
>> to add them or not, but how.
>>
>> > Input Formats
>> > =======================
>> >
>> > Useful formats to support include:
>> >
>> > * `ISO8601`_
>> > * ARPA/`RFC2822`_
>> > * `ctime`_
>> > * Formats commonly written by humans such as the American
>> >   "MM/DD/YYYY", the European "YYYY/MM/DD", and variants such as
>> >   "DD-Month-YYYY".
>
>I didn't notice this going past the first time: YYYY/MM/DD is the
                                                              ^--UIAM, NOT! 
>ISO standard format, DD/MM/YYYY is the European variant to
>the American MM/DD/YYYY.

I thought '-' delimiters were standard, and the yyyy-mm-dd ordering standard,
and anything else a variant.

See
    http://www.w3.org/TR/NOTE-datetime
or
    http://www.iso.ch/iso/en/prods-services/popstds/datesandtime.html

[...]

Regards,
Bengt Richter




More information about the Python-list mailing list