Skip to content

Remarks could/should explain that FindSystemTimeZoneById now supports IANA time zones on Windows #10713

Open
@adamgf1

Description

@adamgf1

Type of issue

Missing information

Description

Hi,

As announced in this blog post, the TimeZoneInfo.FindSystemTimeZoneById method will now actually support IANA time zones on Windows starting in .NET 6.

For example (using C# interactive window in Visual Studio):

> var iana = TimeZoneInfo.FindSystemTimeZoneById("Pacific/Auckland");
> iana
[(UTC+12:00) Auckland, Wellington]

However, the documentation article for this method doesn't actually make any mention of this. It is still written as though the method only retrieves time zones from the Windows registry on Windows (and as though it only supports IANA time zones, via the ICU library, on Linux/macOS):

On Windows systems, FindSystemTimeZoneById tries to match id to the subkey names of the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zones branch of the registry. On Linux and macOS, it uses time zone information available in the ICU Library. If the registry or the library does not have the information for the time zone you desire, you can create a particular time zone either by calling one of the overloads of the CreateCustomTimeZone method or by calling FromSerializedString to deserialize a TimeZoneInfo object that represents the required time zone.

The fact that this API is now fully cross-platform, and supports IANA/tzdata time zone identifiers, is exceptionally helpful, and so I think it would also be really helpful if the documentation made this clearer.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-6.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/TimeZoneInfo.xml

Document Version Independent Id

b282844b-aed0-a026-8f29-be15019ab711

Article author

@dotnet-bot

Metadata

Metadata

Assignees

Labels

Pri3Indicates issues/PRs that are low priorityarea-System.DateTimehelp wantedGood for community contributors to help [up-for-grabs]

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions