經安全檢測,此網站為安全網站,請放心前往原始網址!

python - datetime.datetime.utcnow() why no tzinfo? - Stack Overflow

That means it is timezone naive, so you can't use it with datetime.astimezone you can give it a timezone like this import pytz # 3rd party u=datetime.utcnow() u=u.replace(tzinfo=pytz.utc) now you can change timezones print datetime.astimezone(u, pytz.time

stackoverflow.com

網址安全性掃描由 google 提供