[New-bugs-announce] [issue15563] wrong conversion reported by
Walid Shaari
report at bugs.python.org
Mon Aug 6 09:41:17 CEST 2012
New submission from Walid Shaari:
In the code below the time stamp 1341183050 should be 01 July 2012. however datetime is converting it back to 7 July 2012, the reverse too is wrong, is that just the way i am using the code?
[g_geadm at plcig2 ~]$ ipython
Python 2.6.5 (r265:79063, Jul 14 2010, 11:36:05)
Type "copyright", "credits" or "license" for more information.
In [2]: import datetime
In [3]: import time
In [4]: datetime.datetime.fromtimestamp(1341183050)
Out[4]: datetime.datetime(2012, 7, 2, 1, 50, 50)
time.mktime(dt.timetuple())
In [5]: dt=datetime.datetime(2012, 7, 2, 1, 50, 50)
In [6]: time.mktime(dt.timetuple())
Out[6]: 1341183050.0
In [7]: dt=datetime.datetime(2012, 7, 1, 22, 50, 50)
In [8]: time.mktime(dt.timetuple())
Out[8]: 1341172250.0
In [9]: datetime.datetime.fromtimestamp(1341172250.0)
Out[9]: datetime.datetime(2012, 7, 1, 22, 50, 50)
----------
components: Library (Lib)
messages: 167541
nosy: wshaari
priority: normal
severity: normal
status: open
title: wrong conversion reported by
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15563>
_______________________________________
More information about the New-bugs-announce
mailing list