You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
#305
Closed
jiridanek opened this issue
Dec 28, 2023
· 2 comments
$ python3.12
Python 3.12.0 (main, Oct 2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> print(datetime.datetime.utcnow())
<stdin>:1: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
2023-12-28 17:44:58.040299
>>> print(datetime.datetime.now(datetime.timezone.utc))
2023-12-28 17:44:58.040443+00:00
>>> print(datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None))
2023-12-28 17:44:58.575408
Environment:
The text was updated successfully, but these errors were encountered: