List timezones in C#

timezones



This simple example uses the following code to display the defined timezones.

// Load the timezone information.
private void Form1_Load(object sender, EventArgs e)
{
    foreach (TimeZoneInfo info in TimeZoneInfo.GetSystemTimeZones())
        lstTimezones.Items.Add(info);
}

This code simply loops through the TimeZoneInfo objects returned by TimeZoneInfo.GetSystemTimeZones and adds them to a ListBox. Those objects’ ToString methods display the timezones’ offsets from GMT and their locations, so that’s what appears in the ListBox.


Download Example   Follow me on Twitter   RSS feed


This entry was posted in internationalization, system and tagged , , , , , , , , , , , , , , , . Bookmark the permalink.

One Response to List timezones in C#

  1. Pingback: Select ComboBox or ListBox values that contain target text in C# -

Leave a Reply

Your email address will not be published. Required fields are marked *