[issue22058] datetime.datetime() should accept a datetime.date as init parameter
Alexander Belopolsky
report at bugs.python.org
Thu Jul 24 17:52:22 CEST 2014
Alexander Belopolsky added the comment:
+1
There is currently no obvious way to convert either date or datetime instance to date.
The best solution I can think of is date(*x.timetuple()[:3]):
>>> d = date.today()
>>> t = datetime.now()
>>> date(*d.timetuple()[:3])
datetime.date(2014, 7, 24)
>>> date(*t.timetuple()[:3])
datetime.date(2014, 7, 24)
Certainly date(x) wins hands down over this atrocity.
----------
stage: -> needs patch
type: -> enhancement
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22058>
_______________________________________
More information about the Python-bugs-list
mailing list