locale settings and date parsing under windows
Martin P. Hellwig
martin.hellwig at dcuktec.org
Thu Feb 3 13:13:20 CET 2011
On 02/03/11 10:59, AlienBaby wrote:
> On Feb 3, 10:22 am, AlienBaby<matt.j.war... at gmail.com> wrote:
>> 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..!
> As often happens, writing that out and the working through a bit more,
> I resolved my own question.
> It ended up being a simple matter of translating from posix codes to
> windows codes, so 'fr_FR' becomes 'French_France'...
You might also want to have a look at the contents of:
More information about the Python-list