[issue22058] datetime.datetime() should accept a datetime.date as constructor

Facundo Batista report at bugs.python.org
Thu Jul 24 16:41:32 CEST 2014


New submission from Facundo Batista:

Currently (tested on py3.4):

>>> from datetime import datetime, date
>>> d = datetime.now()
>>> date(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: an integer is required (got type datetime.datetime)

IMO, it's like doing int(float), a truncation of some info. For example, this is what I want to happen:

>>> d
datetime.datetime(2014, 7, 24, 11, 38, 44, 966613)
>>> date(d)
datetime.date(2014, 7, 24)

----------
messages: 223840
nosy: facundobatista
priority: normal
severity: normal
status: open
title: datetime.datetime() should accept a datetime.date as constructor
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22058>
_______________________________________


More information about the Python-bugs-list mailing list