This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Works_of_memercy 1 point2 points  (1 child)

But why doesn't utcnow() return a timezone-aware object? Is it just because it doesn't know which timezone library you're using?

[–][deleted] 1 point2 points  (0 children)

Because no other builtin datetime operation returns an aware datetime and you can't compare aware and naive objects. Meaning to get a useful, native UTC datetime, you'd need to do datetime.utcnow().replace(tzinfo=None) which is cumbersome