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

SourceForge.net noreply at sourceforge.net
Thu Jul 7 13:39:52 CEST 2005


Bugs item #1234123, was opened at 2005-07-07 13:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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


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

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