kurac
kurac

Reputation: 28

How to know what time is it in user's region django?

I have django web app with authentication. I want to see on users profile when he joined(created account).

I have created model field like:

joined_at = models.DateTimeField(auto_now_add=True, blank=True)

but it gives me utc time. Which is 2 hours behind our time. And if someone from China would be able to create an account he would have bad experience with that too. So I want to find out what time it is in user's region and display that on field.

Thanks for help:)

Upvotes: 0

Views: 26

Answers (1)

saro
saro

Reputation: 821

you can use: django-tz-detect 0.4.0

docs

Upvotes: 1

Related Questions