I recently had to add some logic to our ETL that converted UTC to local times. C# makes this a straight forward task, except all we were given was Olson Time Zones (for example "America/Toronto"). Although these are natively supported in Unix, Java and the like, Windows is another story.
The following code will make it easy to convert to the local time using an Olson Time Zone format.
First off, I created a "Tz" class to hold the properties of each Olson Time Zone.
Next, using this Tz class, I create a mapping to convert the Olson format to the regular Time Zone format. Notice that I've included a daylight savings time indicator since some of these Olson Time Zones use daylight savings time, and some don't
I have more entries than this, but just wanted to give you an idea. Also, when we're done, this will be a property of our time zone list class.
I then create a TzList class and add these as members.
Next I add functions return our local time given an Olson Time Zone. This is the where all the work is done.
That's it. We can then convert our UTC time to local time using the Olson Time Zone by calling it like this.