Timezone settings settings.py:

USE_TZ = True
TIME_ZONE = 'Europe/Moscow' # +4

Record in database table(postgresql 9.1, timestamp with timezone :

2012-12-19 15:30:51.164368+04

Django date filter:

date(object.date,"d.m.Y H:i:s"),

And after all this manipulations datetime filed output in template as :

19.12.2012 11:30:51

Why this happens? Why django don't use TZ information?

有帮助吗?

解决方案

When USE_TZ is False, this is the time zone in which Django will store all datetimes. When USE_TZ is True, this is the default time zone that Django will use to display datetimes in templates and to interpret datetimes entered in forms.

Check this document, Django Doc

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top