What is the best way to display the time according to the user's time zone?
I have a Post object:
class Post(models.Model):
submit_date = models.DateTimeField(auto_now_add=True)
...
In the template, I have something like this:
{% load tz %}
<p> TIME: {{ post_object.submit_date|localtime }} </p>
In settings.py:
USE_TZ = True
USE_L10N = True
TIME_ZONE = 'UTC'
Perhaps I am missing something obvious, all I want is a template for displaying user time depending on its time zone. Should I do some logic in the views.py file?
source
share