Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7769513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:10:42+00:00 2026-06-01T16:10:42+00:00

In django docs, it is written that they can always store the datetime objects

  • 0

In django docs, it is written that they can always store the datetime objects in TIME_ZONE provided in settings.

I wanted to ask that is it just sufficient to date time aware objects or do we have to convert them to TIME_ZONE setting? ie if my TIME_ZONE = “America/Los_Angeles” and USE_TZ = True, and I try to save a time zone aware object which is in “UTC”, will that work? That is, will django convert that “UTC” timezone object to “America/Los_Angeles” before saving to the db?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:10:43+00:00Added an answer on June 1, 2026 at 4:10 pm

    I believe that with USE_TZ = True django will save everything to the DB in UTC. Every DateTime object must be timezone aware to be saved. When django retrieves a datetime from the database, it will automatically change it from UTC to an aware time in the time zone indicated by TIME_ZONE in the settings.

    So to answer your question, if you have a timezone aware datetime in UTC (let’s say 19:00) and you save it, it will save to the DB as 19:00. When you retrieve it, django will make it TZ aware in “America/Los_angelos” so the datetime will now be 12:00.

    You can also override the current Timezone setting from what’s in settings by calling

    from django.utils import timezone
    timezone.activate('US/Central')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Django docs say this on the subject: Note also that Django stores signal
The docs for django.core.files.File imply I can do this: print File(open(path)).url but the File
I can't seem to find a solution for the following in the django docs.
Django docs say that Context object is a stack: from django.template import Context c
This must be in the Django docs somewhere but I can't seem to find
I can't see any provision for this in the django docs, so how do
As far as I know, they are absolute equal. However, browsing some django docs,
I try to use assignment_tag from django docs: https://docs.djangoproject.com/en/1.4/howto/custom-template-tags/#howto-custom-template-tags-simple-tags Test project: mysite/ manage.py polls/
I'm trying to set up the simple syndication example from the Django docs, in
I am using the s3boto backend, not the s3 backend. In the django-storages docs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.