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.

Author mark
Recipients mark
Date 2008-03-27.07:27:03
SpamBayes Score 0.020814119
Marked as misclassified No
Message-id <1206602826.96.0.687530064019.issue2494@psf.upfronthosting.co.za>
In-reply-to
Content
# If you run the code below on Py30a3 you get the output shown at the end
import calendar, datetime, time

pastdate = datetime.datetime(1969, 12, 31)
print(pastdate)
timestamp = calendar.timegm(pastdate.utctimetuple())
print(timestamp)
try:
    pastdate_x = datetime.datetime.utcfromtimestamp(timestamp)
except ValueError as err:
    print("FAIL", err)
try:
    print(time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(timestamp)))
except ValueError as err:
    print("FAIL", err)

r"""
Python 30a3

Windows output:

1969-12-31 00:00:00
-86400
FAIL timestamp out of range for platform localtime()/gmtime() function
FAIL (22, 'Invalid argument')

Linux output:
1969-12-31 00:00:00
-86400
1969-12-31T00:00:00
"""
# What this appears to show is that you can't round-trip between
datetimes and timestamps on Windows for dates prior to 1970
History
Date User Action Args
2008-03-27 07:27:07marksetspambayes_score: 0.0208141 -> 0.020814119
recipients: + mark
2008-03-27 07:27:07marksetspambayes_score: 0.0208141 -> 0.0208141
messageid: <1206602826.96.0.687530064019.issue2494@psf.upfronthosting.co.za>
2008-03-27 07:27:05marklinkissue2494 messages
2008-03-27 07:27:04markcreate