Questions tagged [django-timezone]

Timezone handling specific questions with Django

Saving, displaying time is complicated when there are multiple timezones involved. In version 1.4 django web-framework has provided a way to handle them better.

This tag helps to consolidate questions related to use of Django timezone handling.

Here is detail documentation : Time zones

179 questions
0
votes
1 answer

how to convert UTC timezone DateTime in to local timezone using Django ORM query

class Book(models.Model): created_at=models.DateTimeField(auto_now_add=True) this datetime is in utc timezone and I want to this datetime in to local timezone converted using query.
vivek
  • 11
  • 3
0
votes
2 answers

How to change Django's start server time format?

When I start django server using following command: python manage.py runserver It shows current time likes: January 02, 2018 - 15:35:17 But I want to see time format: January 02, 2018 - 3:35:17pm How can I do it? Thank you
0
votes
2 answers

Django form validation failing - pytz and choices

I am trying to let the user set which timezone they are in, however form validation .is_valid() is failing and cannot figure out why. The timezone value for a user is stored in a Profile model. Using ChoiceField and pytz.common_timezones to fill…
James
  • 815
  • 1
  • 13
  • 24
0
votes
0 answers

How to set django current_timezone as system time zone

I have template which displays the time sent from the view. views.py contains following code from datetime import datetime from django.utils import timezone def func(request): now=datetime.utcnow() timezone.activate('Asia/Kolkata') …
vishnu m c
  • 841
  • 1
  • 7
  • 21
0
votes
0 answers

Django timezones and Postgresql

I know this question has discussed not for the first time but I stuck with a problem and confused a little. So I have a celery task that should send reminders in time. In my config: USE_TZ = True TIMEZONE = 'Asia/Singapore' for example I have a…
Denis
  • 7,127
  • 8
  • 37
  • 58
0
votes
1 answer

Django 1.9 testing timezone.now()

TL;DR: Get only current date and current hour and current minute from timezone.now() and not seconds and miliseconds. Django version: 1.9 Python version: 3.5.1 While testing my app's model, I encountered a strange (to me) error. I have this…
0
votes
0 answers

Django timezone for data from xignite

I am using stock data from xignite. I seriously beleive I messed up dates because (unable to say well) its definitely dealing with multiple timezones(due to multiple countries). How to make timezones well? For example if someone sees data for 25th…
user1305989
  • 3,231
  • 3
  • 27
  • 34
0
votes
0 answers

Django timezones examples - why don't I get any time zones?

I've just made use of the example shown in the Django doco of setting the active timezone : https://docs.djangoproject.com/en/1.8/topics/i18n/timezones/#selecting-the-current-time-zone . The thing is I the template shown there renders with nothing…
glaucon
  • 8,112
  • 9
  • 41
  • 63
0
votes
1 answer

How to set local timezone only in django admin

I have UTC time zone in my django settings and I am showing UTC time format to user as well . But I want to change UTC time format to local time zone in django admin. I am using django 1.6. Is there a way to display datetime information to the…
Gaurav Nagpal
  • 155
  • 2
  • 15
0
votes
1 answer

Django : timezone.now() is inappropriate even after making timedate object aware

Datetime objects are stored in UTC and are converted to local timezone while displaying. So when I call timezone.now(), it should convert the UTC to local timezone and display the time accordingly. I have installed pytz as recommended by django. I…
theblackpearl
  • 1,164
  • 3
  • 15
  • 34
0
votes
1 answer

django-timezone-field gets error unicode object has no attribute zone

I was not able to do a migration on one of my model objects that use django-timezone-field in django 1.7 I found a solution here: https://github.com/mfogel/django-timezone-field/issues/12 I installed the forked version of django-time-field which…
Atma
  • 29,141
  • 56
  • 198
  • 299
0
votes
1 answer

Django incorrect naive timezone from system?

I am trying to use times in an intranet system, which will have independent servers/systems run in different time zones. Because time zones are a pain and my use of times is fairly simple (showing the user when they last modified a file, for…
Julia Ebert
  • 1,583
  • 1
  • 21
  • 39
0
votes
1 answer

how to get records for a day relative to timezone in django

I am trying to all the record for a certain day with the following: entered_at = request.session['entered_at'] entered_at = datetime.strptime(entered_at, "%m-%d-%Y") day_start = entered_at.replace(hour=00, minute=00) day_end =…
Atma
  • 29,141
  • 56
  • 198
  • 299
0
votes
0 answers

Determine how Django formats timezones

I have a Django 1.6 project with the following relevant settings: TIME_ZONE = 'America/Los_Angeles' TIME_FORMAT = 'Hi' DATE_FORMAT = 'Y M d' DATETIME_FORMAT = '%s %s e' % (DATE_FORMAT, TIME_FORMAT) USE_TZ = True USE_L10N = False I have an object…
user1272534
  • 991
  • 2
  • 11
  • 17
0
votes
2 answers

How to set up django time_zone properly to used datetime properly in a view

In django 1.5, i used in my settings... : USE_TZ = True TIME_ZONE = 'Europe/Paris' when i created an objects with date_crea= auto_add_now() at 16h20 on my computer in Paris, on the mysql database, date_crea is set to 14h20 ... On my admin…
laurent
  • 660
  • 2
  • 8
  • 19
1 2 3
11
12