[issue26635] Python default date does not match Unix time

STINNER Victor report at bugs.python.org
Thu Mar 24 08:52:44 EDT 2016


STINNER Victor added the comment:

The year 1900 is a delibrate choice, it's even documented:
https://docs.python.org/dev/library/datetime.html#strftime-and-strptime-behavior

"For time objects, the format codes for year, month, and day should not be used, as time objects have no such values. If they’re used anyway, 1900 is substituted for the year, and 1 for the month and day."

> The default year should be <whatever>

If you expect a year, you can easily use dt.replace(year=<whatever>), no?

Or start with a datetime.time object and then build a datetime.datetime using the time? It's up to you.

We will not change a default value, it will break the backward compatibility.

----------
nosy: +belopolsky, haypo
resolution:  -> not a bug
status: open -> closed

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


More information about the Python-bugs-list mailing list