Reputation: 21
I read many topics about the issue - here on stack overflow, msdn etc. However, I couldn't find the 'golden path'.
I have a classic issue here - There are clients from different timezones and a server from another one. The server should use the client timezone. Communication is done through WCF.
The most reasonable solution was to send the date from the client, as a Utc time (i.e.: DateTime.UtcNow (in order to sync the +/- on client) and on the server, use the ToUniversalTime (in order to sync the +/- timezone on server).
I think that this solution will solve my issue, but it will cause to many changes on current code.
Do you know any 'smarter' solutions for my issue ? Did I miss something here ?
Thanks, Joe.
Upvotes: 0
Views: 1545
Reputation: 82096
Generally you want the server to work solely with UTC which should keep your information consistent across any time zone.
It's usually then on the client-side you want to gather some time zone information so you can allow clients to work with the dates/times in the format suited to them.
Upvotes: 2