Hi, Is there any easy way in Django to catch end user's local time when end user access the webpage?
I have read django documentation and tried to google solutions, but I get quite confused. Below you will find my code. In short the code should show a story on my webpage what happened in the past on the current day. However it doesn't take into account the endusers local time, and thus doesn't work properly. *Views.py* from django.utils import timezone t = timezone.now() *[This should somehow react to endusers local time]* dm = t.strftime('%m-%d') history = history.objects.filter(monthday__exact=dm) historystory = random.sample(list(history), 1) args = {'historystory':historystory} return render(request, "news/home.html", args) *home.html* [in html I have just the basic things to show the content] <div class="card"> <div class="card-body"> {% for x in historystory %} <h4 class="card-text"> {{ x.title }} </h4> <h4 class="card-text"> {{ x.subtitle }} </h4> <p class="card-text"> {{ x.content }} </p> {% endfor %} </div> </div> *Settings.py* LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True You can check my webpage (http://www.topithenewsdoggy.com/) to get better understanding what I'm doing. The part is under Additional info. -Mikko -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGD0jj%2Bh_1Pd50eE0e0zXt8P-yozqCnZeYYXTe6bj6Tt6UopxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.