This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Need locale arg to strftime()
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, rhettinger, wsanchez
Priority: normal Keywords:

Created on 2005-06-13 17:32 by wsanchez, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg25534 - (view) Author: Wilfredo Sanchez (wsanchez) Date: 2005-06-13 17:32
strftime()'s behavior is dependant on your current locale.  Sometimes 
this is undesireable, such as when parsing HTTP dates (RFC 2068, 
3.3.1), where on is expected to create and parse dates using English 
month and week names.

A similar problem exists with the lower() string method.

In either case locale magic isn't always desirable, and it would be 
useful to add a locale argument to specify which locale to use.
msg25535 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-06-14 08:59
Logged In: YES 
user_id=80475

Brett, do you want to take this one?
msg25536 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-06-15 02:14
Logged In: YES 
user_id=357491

There is an issue with this idea.  strftime() is just a wrapper around the 
ISO C library function.  We have no direct control over the locale 
handling.  This means that the locale used by strftime() is dictated by 
the locale that the ISO C libraries think you have.

Best thing to do is to temporarily change the locale to what you need, 
use strftime(), and then set the locale back.  PEP 342 would be nice for 
this.  =)  At best this is what strftime() would have to do behind the 
scenes for you.  And the extra overhead is not totally desirable.
msg25537 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-07-11 03:10
Logged In: YES 
user_id=357491

Since no one can seem to refute my logic I am closing this
as invalid.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 42079
2005-06-13 17:32:02wsanchezcreate