0
I saved in my bank a date, in a field of the kind datetime(6)
, the date saved in the database is: 2020-05-13 14:13:50.000000
, however, when I try to print this date in the template using {{ user.time_vip }}
I have as return 13 de Maio de 2020 às 11:13
, note that the time does not match the time that is saved in the database.
Why is this happening?
My settings.py
is configured like this:
LANGUAGE_CODE = 'pt-BR'
TIME_ZONE = 'America/Sao_Paulo'
USE_I18N = True
USE_L10N = True
USE_TZ = True
Taking advantage, how could I verify that this date (time) is bigger than today? Example:
{% if user.time_vip >= timezone.now %}
<span class="d-block mb-3 mt-3 small text-success">Você é vip até {{ user.time_vip }}</span>
{% else %}
<span class="d-block mb-3 mt-3 small text-danger">Você não é vip</span>
{% endif %}
This was an example, it doesn’t work because it returns me a string as I could do it?
I just kept
TIME_ZONE = 'America/Sao_Paulo'
and I becameUSE_TZ = False
, thank you.– Gabriel