TimeZoneInfo.GetSystemTimeZones() how to Select entries for specific country codes only?

前端 未结 2 538
北荒
北荒 2021-01-06 19:56

TimeZoneInfo.GetSystemTimeZones() gives you an Enumeration of all the time zones. The question is how to Select entries for specific country codes only. I know the UTC offse

2条回答
  •  时光取名叫无心
    2021-01-06 20:15

    How about a bit of Linq magic?

    var zones = from tz in TimeZoneInfo.GetSystemTimeZones() where tz.Id = "xxx" select tz;
    

    Replace "xxx" with your desired timezone... :)

提交回复
热议问题