Paul Ganssle <p.gans...@gmail.com> added the comment: Hi dh4931 — this is the expected result, assuming that the offsets changed between those two dates in your system local time.
The .timestamp() method returns an epoch time, which is the number of seconds since 1970-01-01T00:00:00 UTC, and so it is inherently timezone-aware. In Python 3, naïve datetimes went from being "unitless datetimes" to representing "local datetimes", and in certain situations (like calling `.timestamp()`), your system's time zone is used. If you want something that gives the number of seconds that has elapsed between two naïve datetimes on the calendar and ignoring any daylight saving time transitions, subtract them directly to get a timedelta, then divide the result by a timedelta representing 1 second, like so: >>> (datetime.datetime(1986, 5, 4, 7, 13, 22) - datetime.datetime(1986, 5, 4, 0, 0, 0)) / datetime.timedelta(seconds=1) 26002.0 >>> (datetime.datetime(1986, 5, 2, 7, 13, 22) - datetime.datetime(1986, 5, 2, 0, 0, 0)) / datetime.timedelta(seconds=1) 26002.0 ---------- resolution: -> not a bug stage: -> resolved type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41321> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com