Python datetime.utcnow() returning incorrect datetime

I know I’m five years late, but I had the same problem tonight. In my experience, the solution to the problem was to use the aware UTC datetime:

utc_dt_aware =

If you google “utcnow() wrong” this is the first result you get, so I thought it would be good to answer anyway.

Leave a Comment