I'm using .NET 3.5 with VS 2005 C#.

I created a simple application where when I select the time zone from a combo box, it displays the current time of that time zone. To do this I simply use the GetSystemTimeZones() method of TimeZoneInfo class, and then populate the combo box with the TimeZoneInfo.DisplayName of each time zone. Then later I do some more operations to display the time which is pretty much irrelevant in this context. My program works just fine, and here is the code where I get the time zones and how I populate the combo.

//Get the time zones
ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();

//Add the display name of each time zone to the combo box
foreach (TimeZoneInfo zone in zones)

However, I have one problem.

My OS (Windows Vista Business) as well as VisualStudio .NET is Japanese. Therefore, TimeZoneInfo.GetSystemTimeZones() returns time zones with the DisplayName property in Japanese language. However I need this to be in English.

How can that be done?

6 Years
Discussion Span
Last Post by darkagn

Not sure if this will work, but I think you could create your own IFormatProvider from the english culture info object and use that when formatting the names of the time zones. Something like (adapted from this post):

public class EnglishFormatter: IFormatProvider, ICustomFormatter
  private CultureInfo enCulture = CultureInfo.GetCultureInfo("en"); // use en-US for US English
  public string Format(string format, object arg, IFormatProvider formatProvider)
    return String.Format(enCulture, arg);

  public object GetFormat(Type formatType)
    return (formatType == typeof(ICustomFormatter)) ? this : null;

Then you can use this when you add your items to your combo box:

comboBox1.Items.Add(String.Format(new EnglishFormatter(), "{0}", zone.DisplayName);

I haven't actually attempted this so I hope this works for you.

Edited by darkagn: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.