views:

214

answers:

1

Hi SO!

Say I have the value: -5 that represents a TimeZone (GMT-5).

How can I convert that into: "Central DST" or something similarly textual using C# and the .NET framework?

Thanks!

+3  A: 

Using .NET 3.5 you can use TimeZoneInfo.GetSystemTimeZones(), and then iterate through until you find a match using BaseUtcOffset.

Be warned that there may be multiple entries per offset, so your results will be somewhat arbitrary.

Jon B
Fantastic! Followup question? Can I use Lat/Long to figureout which TimeZone value is appropriate?
Alan
I don't think there's a built-in way to do that. You might be able to find a web service that does that. I'd suggest posting another question.
Jon B