0

I'm pulling data from two different sources, both have timestamps. One of the sources uses GMT, and the other uses the time local to their server. I display the information from both of these sources in a list sorted by time. I have users in many time zones. How would I sort these together in the correct order? This is being done in C#.

1 Answers1

4

I would convert all times to UTC, then either display the timestamps in the user's local timezone, or leave them as UTC. My general preference is to use the user's local timezone, as not everyone looks at a UTC time and is able to instantly convert it to local. Use the ToUniversalTime and ToLocalTime methods for the conversions.

  • What about the timestamps that are local to the server? They don't come back with a timezone, how would I convert them to my user's local time? – Drew DeVault Jul 18 '11 at 02:26
  • 1
    Unless you can determine the timezone of that server, you're out of luck. Obviously the timezone could be anything. Any chance of getting the vendor to fix it? –  Jul 18 '11 at 02:39