locale settings and date parsing under windows

AlienBaby matt.j.warren at gmail.com
Thu Feb 3 05:22:54 EST 2011


I'm attempting to convert some date-time strings from a text file
under windows into a datetime object as returned by strptime()

However, the strings can represent dates in various formats based on
the country of origin, for example shortened month names etc.. are
different between countries.

I am trying to set the correct locale for strptime to work, but I'm
having a lot of trouble doing this under windows.

IE, wher the date is in the Danish Language,

import locale


locale.Error: unsupported locale string.

I have tried various ways but always hit the same error.

I understand setting LC_ALL may not be what I require, I was first
looking to simply get the locale setting correctly before I started
changing only the date-time specific elements.

Any help or pointers much appreciated. Current searching around is
revealing a fair amount of confusion..!



More information about the Python-list mailing list