I have:
- A Country (for instance Namibia)
- A DateTime stored in UTC (Let's say 23 October 1955 12:01 PM)
I want to write a function to translate the UTC datetime to local Namibian datetime with historic accuracy, taking into consideration daylight savings time.
I can not use timezones as some countries actually move timezones (Namibia for instance falls under WAT (UTC+1) during winter and WAST (UTC+2) during summer.
Any CSharp functions that can achieve this? Bonus points if this can be achieved by only passing the country's two-letter country code (for instance "NA").
The ideal function signature should be either:
public static DateTime UtcToLocal(this DateTime UtcDateTime, string CountryCode)
or
public static string UtcToLocal(this DateTime UtcDateTime, string CountryCode)
UPDATE
As pointed out in the comments section below, some countries are bound to multiple TimeZones (US for instance). So, the method signatures should rather look as follows:
public static DateTime UtcToLocal(this DateTime UtcDateTime, string TZ_Environment_ZoneName)