[egenix-users] DateTimeFrom problem

M.-A. Lemburg mal at lemburg.com
Mon Jun 2 11:18:07 CEST 2003


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 ;-)

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Jun 02 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
EuroPython 2003, Charleroi, Belgium:                        22 days left



More information about the egenix-users mailing list