124bit
124bit

Reputation: 506

Server and client are python scripts, are there a way to synchronize server to client time without changing system dates anywere?

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

Answers (1)

Lennart Regebro
Lennart Regebro

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

Related Questions