Python Time 2025
By Eric
—
—
2 minute read
A quick reference for time...
Get the current time in UTC
from datetime import datetime, UTC
datetime.now(UTC)
datetime.datetime(2025, 1, 28, 23, 4, 45, 419714, tzinfo=datetime.timezone.utc)
You might think you should use datetime.utcnow()
but:
Deprecated since version 3.12: Use
datetime.now()
with …