John wrote:
> On Monday 09 November 2009 03:09:21 pm Paul McNett wrote:
>> Paul McNett wrote:
>>> Paul McNett wrote:
>>>> Miguel Lopes wrote:
>>>>> On Mon, Nov 9, 2009 at 9:59 PM, Paul McNett <[email protected]> wrote:
>>>>>> Paul McNett wrote:
>>>>>>> However, it should be defaulting to the user's localization settings
>>>>>>> for short date format (operating on the principle that the user
>>>>>>> should be in ultimate control over the formatting of things). If it
>>>>>>> isn't, please let us know!
>>>>>> I just confirmed that this is working on Windows XP. I went into
>>>>>> 'regional and language settings', and selected "English (United
>>>>>> Kingdom)" and then started my app. All the dates were messed up with
>>>>>> the day showing before the month. :)
>>>>>>
>>>>>> Paul
>>>>> I don't get the same on OSX Leopard (10.5.8)
>>>>> I went to System Preferences | International | Formats
>>>>> and then choosing alternative selections in the Region dropdown has no
>>>>> effect on dabo's date formatting.
>>>>>
>>>>> My dates are still messed up with the day showing after the month. :)
>>>> Dabo just delegates this to Python, using time.strftime() with the
>>>> format of "%x". So I guess something on Mac isn't working correctly.
>>>> What version of Python?
>>> I can confirm this problem on Mac Leopard 10.5.7, using python 2.5.4:
>>>  >>> import datetime
>>>  >>> d = datetime.date.today()
>>>  >>> d
>>>
>>> datetime.date(2009, 11, 9)
>>>
>>>  >>> import time
>>>  >>> print time.strftime("%x", d.timetuple())
>>>
>>> 11/09/09
>>>
>>> (should have been "2009/11/09")
>> Also, I can't get it to work on Ubuntu either.
>>
>> Paul
> 
> I'm not dead sure but I think the way the above code would print depends on 
> the default locale.  In your case I bet it's 'en_US, UTF8'.  If I'm correct 
> then it is printing correctly.

Bingo, John. It prints the date format for the current language setting, using 
the 
$LANG environmental variable on Mac and Linux.

After changing the region in system preferences, you need to start a new 
terminal so 
that $LANG reflects the new value.

So Miguel, go into System Preferences|International|Formats and choose the 
region 
"United Kingdom". Then start a new terminal and run your test. I get the UK 
format on 
my Mac when I do this.

Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to