[Ironpython-users] locale with datetimes

Hernán Foffani hfoffani at gmail.com
Fri Jul 20 19:10:52 CEST 2012


Hi,
I'm must be doing something wrong but can't see why I'm not able to get datetime.strftime(…) work as expected:
In IronPython:

IronPython 2.7.2.1 (2.7.0.40) on .NET 4.0.30319.269 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'es_ES')
'es_ES'
>>>
>>> import datetime
>>>
>>> n = datetime.datetime.today()
>>> n.strftime("%c")
'07/20/12 17:40:56'
>>>
>>>


In CPython (Mac OSX)
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'es_ES')
'es_ES'
>>> import datetime
>>> n = datetime.datetime.today()
>>> n.strftime("%c")
'vie 20 jul 19:05:20 2012'
>>> 

I'm not expecting to get the same thing as the Mac but at least something along the lines of dd/mm/yy.

Regards,
Hernán.



More information about the Ironpython-users mailing list