A
A
Artyom Innokentiev2016-02-21 21:10:28
Django
Artyom Innokentiev, 2016-02-21 21:10:28

Django and timezones: what's the problem?

settings.py :

TIME_ZONE = 'Europe/Moscow'
USE_TZ = True

models.py :
class Reserve(models.Model):
    datetime = models.DateTimeField(
        verbose_name='Дата и время'
    )

The date and time of the reserve is sent from the front, the correct time gets inside the view, for example this: 2016-02-22
06:30:00+03:00 2016-02-22 07:30:00.000000 There is an option to change the time zone to 'Europe / Samara' - but this is a crutch in my opinion. UPD : I noticed this: although it is stored in the database an hour later, when reading data through ORM, the time is correct. How can this problem be solved?


Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Voronkov, 2016-02-21
@DmitryVoronkov

Look at the time zone in the DBMS:
And look the same on the server:
sudo dpkg-reconfigure tzdata

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question