Answer the question
In order to leave comments, you need to log in
Lost 1 hour of time when rendering a template in Django?
Good afternoon people of the forum. Faced such a problem when outputting datetime fields to a template, 1 hour of time is lost somewhere in the negative direction.
TIME_ZONE = 'Europe/Moscow'
USE_TZ = True
broadcast.start_translation
Out[7]: datetime.datetime(2017, 11, 17, 12, 0, tzinfo=<UTC>)
In [8]: broadcast.start_translation.isoformat()
Out[8]: '2017-11-17T12:00:00+00:00'
In [9]: broadcast.end_translation
Out[9]: datetime.datetime(2017, 11, 17, 13, 0, tzinfo=<UTC>)
Current default time zone: 'Europe/Moscow'
Local time is now: Tue Nov 14 17:19:31 MSK 2017.
Universal Time is now: Tue Nov 14 14:19:31 UTC 2017.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question