Skip to content

Instantly share code, notes, and snippets.

@jdaigle
Created April 4, 2011 13:56
Show Gist options
  • Save jdaigle/901662 to your computer and use it in GitHub Desktop.
Save jdaigle/901662 to your computer and use it in GitHub Desktop.
public static TimeZoneInfo ToTimeZoneInfo(this TimeZones zone) {
switch (zone) {
case TimeZones.Central:
return TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
case TimeZones.Mountain:
return TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time");
case TimeZones.Pacific:
return TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
case TimeZones.Arizona:
return TimeZoneInfo.FindSystemTimeZoneById("US Mountain Standard Time");
case TimeZones.Alaska:
return TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time");
case TimeZones.Hawaii:
return TimeZoneInfo.FindSystemTimeZoneById("Hawaiian Standard Time");
case TimeZones.Indiana:
return TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time");
case TimeZones.Eastern:
case TimeZones.NotSet:
default:
return TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment