Home > Net >  .NET 6 TimeZoneInfo.TryConvertWindowsIdToIanaId() does return false
.NET 6 TimeZoneInfo.TryConvertWindowsIdToIanaId() does return false

Time:10-18

On Windows Server 2019 Version 10.0.17763 the following code returns false:

TimeZoneInfo.TryConvertWindowsIdToIanaId("W. Europe Standard Time", out var timeZoneIana)

But this code worked on a test machine with Windows Server 2022. What are the system requirements for this method to work?

CodePudding user response:

The methods TimeZoneInfo.TryConvertWindowsIdToIanaId and TimeZoneInfo.TryConvertIanaIdToWindowsId rely on ICU globalization, which is available on Windows machines as of the Windows 10 May 2019 update. That corresponds to Windows Server 1903 (build 10.0.18362).

If you need to support Windows and IANA time zones on older systems, use the TimeZoneConverter library instead. The corresponding method is TZConvert.TryWindowsToIana.

  • Related