Oleg Broytmann wrote: > On Tue, Jun 25, 2002 at 12:21:31PM +0200, M.-A. Lemburg wrote: > >>>>Just curious: have you taken a look at the mxDateTime parser ? >>> >>>is that an extension of the rfc822.parsedate approach? >> >>Yes, but it goes far beyond RFC822 style dates and times. > > >>>>from mx import DateTime >>>>dt = DateTime.DateTimeFrom("21/12/2002") >>>>dt >>> > <DateTime object for '2002-06-25 20:02:00.00' at 819d7f8> > >>>>dt = DateTime.DateTimeFrom("21/08/2002") >>>>dt >>> > <DateTime object for '2002-06-25 20:02:00.00' at 819b860> > >>>>dt = DateTime.DateTimeFrom("21-08-2002") >>>>dt >>> > <DateTime object for '2021-08-20 00:00:00.00' at 819d7f8> > > I am not sure I understand the logic. Because of this I always use ISO > date format (2002-08-21). The problem with the first two is that the parser parses date *and* time (it defaults to today for entries which are not found in the string; this can be changed though). The last one is parsed as ISO date (21-08-20), the trailing 02 is omitted. As you can see date parsing is very difficult, and even though the mxDateTime parser already recognizes tons of different formats, it doesn't always work. It is getting better with each release, though :-) -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ Meet us at EuroPython 2002: http://www.europython.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4