Reputation: 506
I'm using time and datetime modules in server and in client scripts. When I am receiving data that contains date from server - it is wrong and different to client because of wrong timezone and wrong time on server. How to deal with it and what is the best way to deal with it? Thanks
Upvotes: 1
Views: 255
Reputation: 172309
You should either convert the time to the time zone of the client, or show the time zone. I e, for a client in Warsaw show
"2015-05-14 11:40" or "2015-05-14 09:40 GMT" or similar.
Which one you want depends a lot on what data it is you are showing.
How to figure out the client timezone is a long topic that probably is covered elsewhere here, and that again depends on the application. You can convert it with Javascript, or have a setting, or make a guess based on countr and IP address, etc. Loads of options.
Upvotes: 1