Nov. 18, 2023, 7:24 p.m. |

Simon Willison's Weblog simonwillison.net

It's Time For A Change: datetime.utcnow() Is Now Deprecated

Miguel Grinberg explains the deprecation of datetime.utcnow() and utcfromtimestamp() in Python 3.12, since they return naive datetime objects which cause all sorts of follow-on problems.

The replacement idiom is datetime.datetime.now(datetime.timezone.utc)

Via @miguelgrinberg

change datetime objects python python 3 replacement timezones

Senior Data Engineer

@ Exadel | Bulgaria, Hungary, Lithuania, Poland, Romania

Jr Machine Learning Engineer

@ Noblis | Reston, VA, United States

Data Engineer

@ H&M Group | Stockholm, Sweden

Data Science Specialist

@ Jellyfish | Mexico City, Mexico

Business Intelligence Analyst (Mexico)

@ Incode | Mexico, Remote

Commercial Data Analyst

@ iwoca | London, England, United Kingdom