Date Parsing Question

G

Gavin

Hi,

I'm using the python-dateutil package : http://labix.org/python-dateutil
to parse a set of randomly formatted strings into dates. Because the
formats are varied, I can't use time.strptime() because I don't know
what the format is upfront.

python-dateutil seems to work very well if everything is in English,
however, it does not seem to work for other languages and the
documentation does not seem to have any information about locale
support.

Here's an example showing my problem:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.datetime.datetime(2010, 10, 3, 1, 1, 1)

everything is ok so far, now retry with a date in german:
('de_DE', 'cp1252')
Traceback (most recent call last):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python26\lib\site-packages\python_dateutil-1.5-py2.6.egg
\dateutil\parser.py", line 697, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "c:\python26\lib\site-packages\python_dateutil-1.5-py2.6.egg
\dateutil\parser.py", line 303, in parse
raise ValueError, "unknown string format"
ValueError: unknown string format


Am I out of luck with this package? Just wondering if anyone has used
this to work with non-english dates. I'm also open to other ideas to
handle this.

Appreciate the assistance,

Gavin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top