Problem with mxDateTime function DateFromString
Peter Hansen
peter at engcorp.com
Sun Jul 7 08:52:43 EDT 2002
I would submit this somewhere as a defect report except I can't find
an appropriate place on the http://www.lemburg.com site, and all
contact information seems to be surrounded by licensing agreements
and commercial per-incident support fees and such... it's pretty
unfriendly towards someone who doesn't want support, doesn't use
the package, but just wants to point out a little problem so others
can benefit... (no doubt I missed the correct link, but that
just supports my point).
Anyway:
>>> from mx.DateTime.Parser import DateFromString
this is wrong:
>>> DateFromString("October 29/2000")
<DateTime object for '2002-10-29 00:00:00.00' at 811af0>
but this is right:
>>> DateFromString("October 29, 2000")
<DateTime object for '2000-10-29 00:00:00.00' at 7d4250>
Note the year in the results. It would seem that lack of a
space in the first two would not be an entirely unusual situation.
I wouldn't mention it except for the comment in the notes for
the Parser submodule: "The Parser submodule ... will try very hard
to come up with a reasonable output given a valid input." The
first date we gave it, however, had no space after the comma and
it _quietly_ gets it wrong, making it questionable how reliable
it will be for other perhaps unusual inputs.
-Peter
More information about the Python-list
mailing list