投稿/コメントを表示します。

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

utc_timestamp = 1659442920

naive_dt=datetime.utcfromtimestamp(utc_timestamp)
print(naive_dt)

ここまででPrintしましたが、以下のエラーがでました。
C:\Users\kenta\Downloads\pc5bai\20251011\lessons\.venv\Scripts\python.exe C:\Users\kenta\Downloads\pc5bai\20251011\lessons\10_step1\code\practicefile.py
C:\Users\kenta\Downloads\pc5bai\20251011\lessons\10_step1\code\practicefile.py:7: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
naive_dt=datetime.utcfromtimestamp(utc_timestamp)
2022-08-02 12:22:00

Process finished with exit code 0

エラーの意味と原因がわかりかねたのと、少なくとも2022-08-02 12:22:00という回答が表示されているのでエラーかどうかもよくわかりませんでした。
2025/11/19 08:57