TimeZoneInfo
does not provide abbreviation or a short name for a given Timezone. The only good way to do it is to have a dictionary that will map abbreviations
This is is helpful for anyone using Xamarin for iOS or Android because according to the documentation "The display name is localized based on the culture installed with the Windows operating system." When using this in the Central Time Zone, for the DateTime "2016-09-01 12:00:00 GMT", this function returns "CDT" which is exactly what I needed when I came upon this question.
public static string GetTimeZoneAbbreviation(DateTime time)
{
string timeZoneAbbr;
if(time.IsDaylightSavingTime() == true)
{
timeZoneAbbr = TimeZoneInfo.Local.DaylightName;
}
else
{
timeZoneAbbr = TimeZoneInfo.Local.StandardName;
}
return timeZoneAbbr;
}