Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adamgf1 opened this issue Nov 26, 2024 · 0 comments
Labels
area-System.DateTime Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@adamgf1
Copy link

adamgf1 commented Nov 26, 2024

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

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Nov 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.DateTime Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant