我知道我们可以使用 id 查找时区信息
TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
有什么我们可以用名字来获取的东西吗?
example:
TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneByName("(UTC-12:00) International Date Line West");
没有像这样的内置方法。
最佳答案
您显示的名称是显示名称。一个简单的 linq 查询可以为您带来。
string displayName = "(UTC-12:00) International Date Line West";
var tz = TimeZoneInfo.GetSystemTimeZones()
.FirstOrDefault(x => x.DisplayName == displayName);
关于c# - 如何按名称查找 TimeZoneInfo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23423851/