Finally got around to dealing with one of those "DeprecationWarning: datetime.datetime.utcnow() is deprecated" warnings, so I wrote it up as a tiny TIL:
til.simonwillison.net/python/u

@simon I have been using using zoneinfo.ZoneInfo for python v3.9+ (else, pytz.timezone, specifically for v3.6).

I take it if I am not doing any time zone conversions & only using UTC date-time, then zoneinfo is not needed (not to mention an extra import)?

#Python

@anubhav yeah as far as I can tell you don't need an extra packages for UTC from 3.9 onwards (and maybe earlier)

Follow

@simon @anubhav The UTC object was added in 3.2 I believe.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.