[egenix-users] DateTimeFrom parser error

M.-A. Lemburg mal at egenix.com
Thu Feb 19 20:22:34 CET 2004


Jim Vickroy wrote:
> Me too.
> 
> But eliminating the "PM" designator does not fail:
> 
> 
>>>>DateTimeFrom('Thursday, February 19, 2004 12:05:34 CST')
> 
> <DateTime object for '2004-02-19 18:05:34.00' at 10ee9a0>
> 
> 
> My system:
> 
> Microsoft Windows 2000
> Python 2.3.3
> egenix-mx-base-2.0.5.win32-py2.3.exe

That's a known bug in 2.0.x. It is fixed in the 2.1.x series which still
hasn't made it to general release version because of too many other projects
keeping us busy:

 >>> from mx.DateTime import *
 >>> DateTimeFrom('Thursday, February 19, 2004 12:05:34 PM CST')
<DateTime object for '2004-02-19 18:05:34.00' at 82e9fa0>

FWIW, if you are an mxODBC Zope DA user, you're lucky... it ships
with the current 2.1.x versions of egenix-mx-base under the covers.

> Edwin Grubbs wrote:
> 
> 
>>I get parse error when parsing a date in this format when the hour is
>>"12".
>>
>>
>>>>>from mx.DateTime import DateTimeFrom
>>>>>DateTimeFrom('Thursday, February 19, 2004 12:05:34 PM CST')
>>
>>Traceback (most recent call last):
>>  File "<stdin>", line 1, in ?
>>  File "/usr/lib/python2.2/site-packages/mx/DateTime/DateTime.py", line 219, in DateTimeFrom
>>    return Parser.DateTimeFromString(arg)
>>  File "/usr/lib/python2.2/site-packages/mx/DateTime/Parser.py", line 567, in DateTimeFromString
>>    raise DateTime.RangeError,\
>>mx.DateTime.RangeError: Failed to parse "Thursday, February 19, 2004 12:05:34 PM CST": hour out of range (0-23): 24
>>
>>But parsing 11 o'clock works fine:
>>
>>
>>>>>DateTimeFrom('Thursday, February 19, 2004 11:05:34 PM CST')
>>
>><DateTime object for '2004-02-20 05:05:34.00' at 81bd228>
>>
>>-Edwin
>>
>>_______________________________________________________________________
>>eGenix.com User Mailing List                     http://www.egenix.com/
>>http://lists.egenix.com/mailman/listinfo/egenix-users
> 
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 19 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2004-01-23: Released mxODBC.Zope.DA 1.0.8        http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list