I am building a application where the clients are supposed to pass a datetime field to query the database. But the client will be in different timezones, so how to solve that problem. Should I make it a point that the client's timezone is used as deafult for each user or the server for every user. And if so than how can I do it?
Asked
Active
Viewed 119 times
2 Answers
1
generally, the server is setup to run as UTC, which has no daylight saving time, etc, and each user's settings contains their preferred timezone. Then you do the time difference calculation. You DB might have that feature.

Christopher Mahan
- 7,621
- 9
- 53
- 66
-
What do you mean my DB will have that feature? I am using MySQL, so where will that feature be? – Saransh Mohapatra Oct 17 '12 at 06:26
-
@SaranshMohapatra See http://stackoverflow.com/questions/4141611/handling-timezones-in-mysql-without-zoneinfo – Christopher Mahan Oct 17 '12 at 17:46
-
@SaranshMohapatra See also http://stackoverflow.com/questions/1697304/php-mysql-timezone-clarification – Christopher Mahan Oct 17 '12 at 19:39
0
Just use the django timezone feature to get the timezone of the user and to convert it to your local timezone for the db-query.

Thomas Schwärzl
- 9,518
- 6
- 43
- 69