Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
Django non-UTC timezone aware dates in queryset

I'm running Django with Postgres.

  1. I want timezone-aware datetime objects returned from the database.
  2. I want all the datetimes in querysets to be set to the user's locale, not UTC.
  3. I can get timezone aware dates in querysets if I set USE_TZ=True in settings, but they are all in UTC.
  4. If USE_TZ=False and set TIME_ZONE='America/New_York', I can get my results back in the user's correct locale, but the dates are all naive.

How can I get timezone-aware datetimes in the user's locale returned in my querysets by default?

Looping through the results and setting them all manually is not an option. It's way too slow.

I'm not interested in Django's ability to convert the dates to the user's timezone at render time, i.e. in a template or serializer. I need the timezone shifted dates before the view for processing.

Note: I think I've read the entire Internet on this topic and found one SO post (Ouput timezone aware django datetime fields without filters) that comes close to the same problem I want to solve, but no solution was provided.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!