rossmcm
rossmcm

Reputation: 5640

Is there an Windows API routine for getting the timezone name in English?

The Windows GetTimeZoneInformation function returns StandardName and DaylightName members of the resultant TIME_ZONE_INFORMATION structure localized according to the current user default UI language. I thought I saw somewhere a means of getting the names in English irrespective of the language the users' PC is running (but I can't find it...).

Does anyone know if this can be done?

Upvotes: 4

Views: 1186

Answers (1)

Vsevolod Golovanov
Vsevolod Golovanov

Reputation: 4226

Use SetThreadUILanguage.

I can only give a C++ example.

LANGID en = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
SetThreadUILanguage(en);

TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);

MessageBoxW(NULL, tzi.StandardName, tzi.DaylightName, MB_OK);

Upvotes: 1

Related Questions