Search code examples
htmldjangowindowsdjango-modelsdebian

"June 8 2023, 02:00 pm" change to "8 June 2023, 14:00"


please help me figure this out. I made a project on django on Windows OS, transferred it to debian server, everything works, but there is a problem with displaying the date: I use updated_at = models.DateTimeField(auto_now=True), on Windows OS it is displayed as: 8 June 2023, 14:00, but on debian for some reason it is displayed as: June 8 2023, 02:00 pm. What could be the problem? How to fix?


Solution

  • Need to add |date:"j F Y, G:i"

    before: {{ updated_at }}

    after: {{ updated_at|date:"j E Y, G:i" }}

    https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#date