To get the equivalent of TimeZoneInfo.Local.Id , not being able to use the TimeZoneInfo class, you need to go directly to the registry.
In .NET 2.0 C #, you can get it using the following method:
private static string GetLocalTimeZoneId() { RegistryKey key = Registry.LocalMachine.OpenSubKey( @"SYSTEM\CurrentControlSet\Control\TimeZoneInformation"); string value = (string)key.GetValue("TimeZoneKeyName"); if (string.IsNullOrEmpty(value)) value = (string)key.GetValue("StandardName"); key.Close(); return value; }
Windows Vista and above have a TimeZoneKeyName value and have a pointer @tzres.dll pointer in the value of StandardName .
Prior to Windows Vista, the StandardName value contained the key name and was not localized.
The above code takes into account both options.
source share