Forums

Working with dates and tz

I have an app that needs to get the user's local date. With that date, I then need to do some computations in python and return those results to the user. The problem is that by using datetime package I get everything in UTC time (server's time), which not always coincide with the user's local time. I tried changing the TZ environ variable and using pytz and although these options work, they require me to know beforehand which is the user's current tz.

So my question is, how can I get the user's local date (and tz) when they sign in so that I can do some computations with them on python, and render them back to the user in html after? I would like to avoid asking the user for this information explicitly on a form.

I hope that is clear enough.

Here you go: https://stackoverflow.com/questions/6939685/get-client-time-zone-from-browser