Country specific date format

Franz Steinhäusler franz.steinhaeusler at
Fri Oct 8 21:46:36 CEST 2004

On Fri, 08 Oct 2004 13:28:04 +0200, "Diez B. Roggisch"
<deetsNOSPAM at> wrote:

>Franz Steinhaeusler wrote:
>> Hello,
>> with following function, i get a human readable date/time format.
>> mtime = time.strftime(self.timeformat ,time.localtime(st.st_mtime))
>> However is there a simple solution to get a country specific format:
>> for example
>> 10/08/2004
>> and for German:
>> 08.10.2004
>> I looked in locale class, but I didn't get more wise.
>You didn't look properly:

Hi Diez,

you are right :)

>>>> locale.nl_langinfo(locale.D_FMT)
>>>> locale.setlocale(locale.LC_ALL, 'de_DE')
>>>> locale.nl_langinfo(locale.D_FMT)

thanks for answering, I have windows XP,
and it seems, this method doesn't exist:

import locale
Traceback (most recent call last):
  File "<input>", line 1, in ?
AttributeError: 'module' object has no attribute 'nl_langinfo'
WinXP, Python 2.3.3

from the doc:
nl_langinfo( option) 

Return some locale-specific information as a string. This function is
not available on all systems, and the set of possible options might
also vary across platforms. The possible argument values are numbers,
for which symbolic constants are available in the locale module. 

is there any possibility ( please WITHOUT the win32 extensions and
other extra package except for wxPython ;) )
to discover the date/time country specific string?



Franz Steinhaeusler
Project Page:

More information about the Python-list mailing list