Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
jessekv
on April 13, 2025
|
parent
|
context
|
favorite
| on:
Whenever: Typed and DST-safe datetimes for Python
I recently learned that there is datetime.UTC which is an alias of datetime.timezone.utc
It helps a bit with the verbosity:
from datetime import datetime, UTC
datetime.now(UTC)
maleldil
on April 13, 2025
[–]
That's from 3.11 onwards.
Consider applying for YC's Summer 2026 batch! Applications are open till May 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
It helps a bit with the verbosity:
from datetime import datetime, UTC
datetime.now(UTC)