Alan
Alan

Reputation: 46813

.NET Convert Number to TimeZone value

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!

Upvotes: 1

Views: 958

Answers (1)

user27414
user27414

Reputation:

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.

Upvotes: 3

Related Questions