Back
datetime.datetime.utcnow()
Why does this datetime not have any timezone info given that it is explicitly a UTC datetime?
I would expect that this would contain tzinfo.
The meaning of datetime.datetime.utcnow() means it is timezone naive, so you can't use it with datetime.astimezone
you can give it a timezone like this
import pytz pytz u = datetime.utcnow() u = u.replace(tzinfo=pytz.utc)
import pytz
pytz u = datetime.utcnow()
u = u.replace(tzinfo=pytz.utc)
31k questions
32.8k answers
501 comments
693 users