I am aware of the System.TimeZone class as well as the many uses of the DateTime.ToString() method. What I haven\'t been able to find is a way to convert a DateTime to a st
Ok, It's been 4 years (and almost a week), it's time we brought LINQ into the discussion...
Putting together Criag's and Bob's ideas...
public static String TimeZoneName2(DateTime dt)
{
var return ToCurrentTimeZoneShortString(dt)
.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);
return sSplit.Aggregate("", (st,w)=> st +=w[0]);
}
Unless you can trust TimeZone to never return a string with two consecutive spaces:
public static String TimeZoneName3(DateTime dt)
{
return ToCurrentTimeZoneShortString(dt).Split(' ')
.Aggregate("", (st,w)=> st +=w[0]);
}