List all the TimeZones available on your machine using C# or VB.NET

To list the different TimeZones on your machine, use the TimeZoneInfo class. Here’s a sample:

C#

static class Program
{
public static void Main(string[] args)
{
var tzone = TimeZoneInfo.GetSystemTimeZones();

foreach (TimeZoneInfo tzi in tzone)
{
Console.WriteLine("{0}", tzi.DisplayName);
}
Console.ReadLine();
}

}

VB.NET

Class Program
Private Sub New()
End Sub
Public Shared Sub
Main(ByVal args() As String)
Dim tzone = TimeZoneInfo.GetSystemTimeZones()

For Each tzi As TimeZoneInfo In tzone
Console.WriteLine("{0}", tzi.DisplayName)
Next tzi
Console.ReadLine()
End Sub

End Class

OUTPUT

image

1 comment: