[egenix-users] DateTimeFrom parser error

Jim Vickroy Jim.Vickroy at noaa.gov
Thu Feb 19 11:20:18 CET 2004


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


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



More information about the egenix-users mailing list