[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: 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 the example to experiment with it and to see additional details.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.