python - Django Timezone UTC -


I am currently working with Postgradu DB on a Zodoz project. Data accumulated in DB with time-ticket using Davis time (user's local time) However, we have

  USE_TZ = True  

in setting.py, which means that all time-stamps received by Django ORM are converted into UTC .

Generally, it's okay. However, for the function I'm just creating, real time is needed (local time for iisers). Of course, I will get the data and will change over time to repeat the time: 1. I can change EST or anything at any time, but I still do not know the original time; 2. I want to change during the ORM question because it will be more efficient.

Do anyone have a clue about this? Thanks in advance!

1) If the original figures are really naive then I would have thought that they have been archived There is also a time-set set in TIME_ZONE setting (which is the default on 'America / Chicago' , but may be anything else in your case)). Then changing back to that timezone will probably give you the original time. From the Django docs:

"When USE_TZ is incorrect, this is the time zone in which Django will store all the datasets. When USE_TZ is true, this will be the default time zone that will be used for Django templates Display the dataset in and to interpret the data in the format. "

()

Generally the time zone information is actually set to DB Connection () , So it is expected that when you Do not connect the Postgrej through Piselel your Dettaim in C, then used the Taimjhn will be missed in the time zone of your system, I would not be sure that you do this with the raw questions Dijengo.

2) I can not say that I have done many hours of research, although I believe that like setting USE_TZ you have to change the postal query, possibly the connection Timezone can override, but I do not have an easy way to do this at runtime because it will default on UTC due to USE_TZ .

I have worked on previous projects and have to follow similar issues which we have either passed the responsibility as suggested in your comment (Returns the UTC dataset of the audience and UTC Converts the data back) or we also store the user timezone. Post Query Conversion is not proved in our use case.


Comments