L
L
LVitA2021-04-07 22:19:18
Django
LVitA, 2021-04-07 22:19:18

Why does django return date always in UTC?

Please tell me why django returns date in utc regardless of settings:

LANGUAGE_CODE = 'ru-ru'
TIME_ZONE = 'Europe/Moscow'
USE_I18N = True
USE_L10N = True
USE_TZ = True


in response, the date comes in the form "created_at": "2021-03-04T23:23:20.259860+00:00"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mkone112, 2021-04-08
@mkone112

Look towards the bd. How is the date stored there?

A
Antonio Solo, 2021-04-08
@solotony

because dates are stored in UTC and are converted to the desired time zone when output

{% load tz %}

{{ value|localtime }}

{% localtime on %}
    {{ value }}
{% endlocaltime %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question