Skip to content

Replace deprecated datetime.utcfromtimestamp, datetime.utcnow#420

Merged
pitbulk merged 1 commit intoSAML-Toolkits:masterfrom
andersk:naive-utc
Jul 3, 2025
Merged

Replace deprecated datetime.utcfromtimestamp, datetime.utcnow#420
pitbulk merged 1 commit intoSAML-Toolkits:masterfrom
andersk:naive-utc

Conversation

@andersk
Copy link
Copy Markdown
Contributor

@andersk andersk commented Oct 22, 2024

https://docs.python.org/3/whatsnew/3.12.html#deprecated

datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC.

https://docs.python.org/3/whatsnew/3.12.html#deprecated
“`datetime.datetime`’s `utcnow()` and `utcfromtimestamp()` are
deprecated and will be removed in a future version. Instead, use
timezone-aware objects to represent datetimes in UTC: respectively,
call `now()` and `fromtimestamp()` with the `tz` parameter set to
`datetime.UTC`.”

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@fumiyas fumiyas mentioned this pull request Jun 23, 2025
@pitbulk pitbulk merged commit dc4e788 into SAML-Toolkits:master Jul 3, 2025
@andersk andersk deleted the naive-utc branch April 2, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants