Converting DD MM YYYY into YYYY-MM-DD?

Gilles Ganault nospam at
Tue Aug 18 10:19:53 CEST 2009

On Tue, 18 Aug 2009 01:11:20 -0700, Rami Chowdhury
<rami.chowdhury at> wrote:
>Could you let me know which platform this is on (Windows, *nix)? It may be a 
>locale encoding issue -- the locale.setlocale() function allows the second 
>argument to be a tuple of (locale_code, encoding), as below:
>locale.setlocale(locale.LC_ALL, ('FR', 'UTF-8'))

It's on XP, and I'm using ActivePython

Python doesn't like the above:

#locale.Error: unsupported locale setting
locale.setlocale(locale.LC_ALL, ('FR', 'UTF-8'))

Maybe it was introduced in more recent versions of Python?

>Since this is for a one-shot (and presumably threading-agnostic) program, and 
>a fairly trivially formatted date-string, I would suggest using 
>( and 
>not regular expressions (which IIRC have Issues with non-ASCII characters). 

If the regex library can only handle basic latin characters, I'll wait
until a script I'm running is done, and I'll upgrade to the to
see how it goes.

Thank you.

More information about the Python-list mailing list