[Zope3-dev] Re: date parsing: explicit is better
Shane Hathaway
shane@zope.com
Fri, 22 Nov 2002 10:05:54 -0500
Steve Alexander wrote:
>> I have no over view over all date formats but does not the usage of
>> dots inside the date mean DD.MM.YYYY and not MM.DD.YYYY. In
>> understanding the US notation with '-' implies MM-DD-YYYY. But I am
>> not sure if this right :)
>
>
> That's a very subtle distinction. I'd call that a very subtle form of
> explicitness ;-)
>
> I have seen British dates written with "/", "." and "-" as separators,
> in order from most common to least common.
>
> I would much rather see an explicit API than rely on the use of a
> particular separator. Specifically, I don't think 11-05-2002 is
> necessarily the same date as 05.11.2002. It all depends on locale and
> conventions.
Ooh, ooh, I smell a new method for the locale service.
ILocaleService.parseDate() or somesuch would return a date given a text
string, raising an error if it's ambiguous. This would even let us deal
with non-US month names, as in "05-OUT-02" (Portuguese), or whatever
unusual conventions people use around the world.
Shane