mattjohnsonpint / TimeZoneNames

Provides a complete source of localized time zone names and abbreviations.
MIT License
196 stars 32 forks source link

BCL standard name for AUS Eastern Standard Time #42

Closed gooderic1977 closed 6 years ago

gooderic1977 commented 6 years ago

I was expecting TZNames.GetNamesForTimeZone return a result contain a valid BCL standard timezone name, e.g.:

TZNames.GetNamesForTimeZone("Australia/Sydney","en-US").Standard -> AUS Eastern Standard Time

However, I got a result: "Australia Eastern Standard Time" instead. This is not a valid standard timezone name

mattjohnsonpint commented 6 years ago

I think you are confusing names for identifiers. TimeZoneNames produces human-readable localizable names, for display to end users. If you just want conversion to Microsoft (BCL) standard time zone identifiers, use TimeZoneConverter instead.

I maintain both libraries, and TimeZoneNames takes a dependency on TimeZoneConverter, so you probably already have it.

string tz = TZConvert.IanaToWindows("Australia/Sydney"); //=> "AUS Eastern Standard Time"