[Zope3-dev] datetimeutil.py for the rest of us

Terry Hancock hancock at anansispaceworks.com
Wed Jun 2 17:58:00 EDT 2004


On Sunday 30 May 2004 01:51 pm, Martijn Faassen wrote:
> Stuart Bishop wrote:
> >     - If an ambiguous datetime format is parsed, it assumes US format.
> >       I feel that this case should instead raise an exception.
> >       If US programmers insist on being able to write broken code,
> >       seperate US specific methods could be made available in
> >       datetimeutils.py or a seperate US centric module.
> 
> I strongly agree that the datetime parser should *not* try to make sense 
> of wrong data. If the format says mm-dd-yy and the date doesn't fit in 
> it as it's dd-mm-yy, it should fail, and verse versa. I'm not the only 
> one who has run into bugs (outside of Zope, mind) because people insist 
> of doing it the Perl way and guess at it, instead of doing it the Python 
> way and refusing to guess.

Well, if you're going to assume a format, it seems more appropriate to
assume *metric* order rather than either European or American. The metric
standard says the numbers should be in decreasing order of significance,
just like written decimal numbers.  Thus: YYYY-MM/DD.

I always record dates that way.  DateTime doesn't read them right, though.
(If "right" is the right word).  Generally it seems to me that the app
programmer has to specifically ask for year, month, and day separately if
they want to get correct results.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Zope3-dev mailing list