marianom
January 15th, 2007, 08:09 PM
Hi, see this please:
mariano@mishima:~/sourcecode/$ date +%x
15/01/07
mariano@mishima:~/sourcecode/$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> print locale.nl_langinfo(locale.D_FMT)
%m/%d/%y
>>>
As you can see with the "date" function, the locale mask for date in my system is dd/mm/yyyy. However when I try it with locale.D_FMT in python it gives me mm/dd/yyyy.
As I read in Python Library Reference (page 721):
D_FMT Return a string that can be used as a format string for strftime(3) to represent a date in a locale-specific way.
So I expect the function to return %d/%m/%y. Can you explain me why it's happening?
Thanks in advance
mariano@mishima:~/sourcecode/$ date +%x
15/01/07
mariano@mishima:~/sourcecode/$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> print locale.nl_langinfo(locale.D_FMT)
%m/%d/%y
>>>
As you can see with the "date" function, the locale mask for date in my system is dd/mm/yyyy. However when I try it with locale.D_FMT in python it gives me mm/dd/yyyy.
As I read in Python Library Reference (page 721):
D_FMT Return a string that can be used as a format string for strftime(3) to represent a date in a locale-specific way.
So I expect the function to return %d/%m/%y. Can you explain me why it's happening?
Thanks in advance