[ python-Bugs-1234123 ] datetime.strftime %s

SourceForge.net noreply at sourceforge.net
Thu Aug 3 22:34:20 CEST 2006


Bugs item #1234123, was opened at 2005-07-07 07:39
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1234123&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Postponed
Priority: 5
Submitted By: Peter Kleiweg (peterkleiweg)
Assigned to: Nobody/Anonymous (nobody)
Summary: datetime.strftime %s

Initial Comment:
I don't know if this is a bug in datetime or in pytz,
so I submitted this as a bug with pytz as well:
https://sourceforge.net/tracker/index.php?func=detail&aid=1233776&group_id=79122&atid=555590

The first example does not give the result I expect.
The second does.

Python 2.3.4 (#1, Aug  6 2004, 18:12:39) 
[GCC 2.95.3 20010315 (SuSE)] on linux2
>>> from datetime import datetime
>>> from pytz import timezone
>>> utc = timezone('UTC')
>>> utc_dt = datetime(1970, 1, 1, 0, 0, 0, tzinfo=utc)
>>> print utc_dt
1970-01-01 00:00:00+00:00
>>> print utc_dt.strftime('%c * %Z * %s')
Thu Jan  1 00:00:00 1970 * UTC * -3600


Python 2.3.4 (#1, Aug  6 2004, 18:12:39) 
[GCC 2.95.3 20010315 (SuSE)] on linux2
>>> import os
>>> os.environ['TZ'] = 'UTC'
>>> from datetime import datetime
>>> from pytz import timezone
>>> utc = timezone('UTC')
>>> utc_dt = datetime(1970, 1, 1, 0, 0, 0, tzinfo=utc)
>>> print utc_dt
1970-01-01 00:00:00+00:00
>>> print utc_dt.strftime('%c * %Z * %s')
Thu Jan  1 00:00:00 1970 * UTC * 0


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-08-03 16:34

Message:
Logged In: YES 
user_id=11375

Given that tzinfo is coming from the pytz package, which is
external to Python, it seems unlikely that this is a Python
bug.  If the pytz developers ultimately track down the
problem to a Python bug, they can surely provide a test case
for Python that doesn't depend on external software.

Closing this bug; it can be reopened if it turns out to be a
Python problem.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1234123&group_id=5470


More information about the Python-bugs-list mailing list