|
|
|
|
|
by mark-r
424 days ago
|
|
Yeah, utcnow is completely broken. They should have fixed it when they created datetime.timezone.utc, but they didn't. The recommendation is to use datetime.datetime.now(datetime.timezone.utc) instead. utcnow should be deprecated and eventually removed. |
|
It helps a bit with the verbosity:
from datetime import datetime, UTC
datetime.now(UTC)