Why are some time zones returned by GetSystemTimeZones not found by FindSystemTimeZoneById?

前端 未结 1 835
半阙折子戏
半阙折子戏 2021-02-05 18:44

I\'ve got an odd problem I can\'t seem to resolve. When I call TimeZoneInfo.GetSystemTimeZones on my Win 7 x64 machine I get 101 results. When I call TimeZone

相关标签:
1条回答
  • 2021-02-05 19:12

    TimeZoneInfo.FindSystemTimeZoneById method accepts the time zone id as parameter. You're using timeZoneInfo.StandardName instead.

    It seems, that for these 3 zones values for TimeZoneInfo.StandardName and TimeZoneInfo.Id properties are different. Using this:

    TimeZoneInfo.FindSystemTimeZoneById(timeZoneInfo.Id);
    

    will solve the issue.

    0 讨论(0)
提交回复
热议问题