↓ Skip to main content

“These methods should have been designed to fail when a naive datetime object is passed to them”

Miguel Grinbergblog.miguelgrinberg.com ↗

Python 3.12 deprecates datetime.utcnow() and tells you to use datetime.now() with UTC instead. The old call hands back a naive object, and timestamp() quietly reads that as local time. Round-trip the Unix epoch on an EST machine and you land 5 hours off with no error. Removal is “likely a few years out,” so the bad timestamps keep piling up until then.