[egenix-users] DateTimeFrom problem

Gene Chow genechow at pacbell.net
Mon Jun 2 09:20:30 CEST 2003


On Monday, June 2, 2003, at 01:18  AM, M.-A. Lemburg wrote:

> M.-A. Lemburg wrote:
>> Gene Chow wrote:
>>> I'm using egenix-mx-base-2.0.4 on Mac OS X. The following behavior 
>>> is easy to work around, but it does not seem correct or desirable.
>>>
>>> Python 2.1.3 (#1, Aug 29 2002, 17:22:52)
>>> [GCC 3.1 20020420 (prerelease)] on darwin6
>>> Type "copyright", "credits" or "license" for more information.
>>>  >>> from mx.DateTime import DateTimeFrom
>>>  >>> DateTimeFrom('2003/05/28')
>>> <DateTime object for '2028-03-05 00:00:00.00' at 18e670>
>>>  >>> DateTimeFrom('2003-05-28')
>>> <DateTime object for '2003-05-28 00:00:00.00' at 13b740>
>>>  >>>
>> There's nothing much you can do about this without also
>> breaking parsing of dates like 03/05/28. The version with
>> '-' is ISO compliant so that no problem to parse correctly.
>
> Hmm, just tested this with the upcoming egenix-mx-base-2.1.0
> and it works just fine:
>
> >>> from mx.DateTime import DateTimeFrom
> >>> DateTimeFrom('2003/05/28')
> <DateTime object for '2003-05-28 00:00:00.00' at 817df90>
>
> Looking at the code, we have added a special new parser
> for these US style ISO dates... probably easier than
> teaching correct ISO to Americans ;-)
>

Thanks for checking and for the new parser just for us Americans :-) In 
general though, I would think that a range check on the month would be 
nice for everyone.

Gene



More information about the egenix-users mailing list