Eryk Sun added the comment:

As Martin said, you need to set the LC_TIME category using an empty string to 
use the locale LC_* environment variables. Python 3 sets LC_CTYPE at startup 
(on Unix platforms only), but LC_TIME is left in the initial C locale:

    >>> locale.setlocale(locale.LC_CTYPE, None)
    'en_DK.UTF-8'
    >>> locale.setlocale(locale.LC_TIME, None)
    'C'
    >>> time.strftime('%x')
    '02/06/17'

    >>> locale.setlocale(locale.LC_TIME, "")
    'en_DK.UTF-8'
    >>> time.strftime('%x')
    '2017-02-06'

----------
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29457>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to