[ python-Bugs-898253 ] strftime ignores date format on winxp
SourceForge.net
noreply at sourceforge.net
Sun Mar 14 01:18:59 EST 2004
Bugs item #898253, was opened at 2004-02-16 15:19
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=898253&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthew Sherborne (matiu)
>Assigned to: Nobody/Anonymous (nobody)
Summary: strftime ignores date format on winxp
Initial Comment:
On Windows XP in the control panel set your country to
"New Zealand".
This gives a short date format of 'dd-mm-yy'
Now in python:
>>> from time import *
>>> print strftime('%c', localtime)
02/17/04 09:15:10
>>> print strftime('%x', localtime())
02/17/04
This is giving the date in the format 'mm-dd-yy'
(American).
Could it be to do with the 'locale.nl_langinfo' bieng
unavailable in xp?
Versions:
ActivePython 2.3.2 Build 232 (ActiveState Corp.) based
on Python 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC
v.1200 32 bit (Intel)] on win32
Windows XP Home Edition (up to dateish)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-03-14 01:18
Message:
Logged In: YES
user_id=31435
I think it's a feature that locale-dependent behavior defaults
to "C" locale, and doesn't change unless you explicitly change
the locale.
>>> import time, locale
>>> now = time.localtime()
>>> time.strftime("%c", now)
'03/14/04 01:14:52'
>>> locale.setlocale(locale.LC_ALL, "german")
'German_Germany.1252'
>>> time.strftime("%c", now) # that changed what "%c" does
'14.03.04 01:14:52'
>>>
I also think C's locale gimmicks suck (e.g., there's no portable
set of locale names across platforms), but that's all we've got
for now.
IOW, this isn't a bug.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2004-03-14 01:04
Message:
Logged In: YES
user_id=80475
Tim, what do you think?
----------------------------------------------------------------------
Comment By: Brett Cannon (bcannon)
Date: 2004-02-17 16:50
Message:
Logged In: YES
user_id=357491
This is a Windows C library bug and nothing to do with our end.
Since time.strftime is just a wrapper around ISO C's strftime function we
just pass in the arguments and then pass them back out without fiddling
with anything.
So unless there is some compiler setting that needs to be set to be more
locale-sensitive (doubt it, but since I don't have a Windows box I have no
way of knowing; this is why I am unassigning this from myself) this is
probably invalid and Microsoft's fault.
----------------------------------------------------------------------
Comment By: Matthew Sherborne (matiu)
Date: 2004-02-16 15:29
Message:
Logged In: YES
user_id=304464
Sorry, code should be:
>>> from time import *
>>> print strftime('%c', localtime())
02/17/04 09:15:10
>>> print strftime('%x', localtime())
02/17/04
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=898253&group_id=5470
More information about the Python-bugs-list
mailing list