1

为什么 .NET 中的 TimeZoneInfo 类会显示 Indiana 遵守夏令时?我认为印第安纳州的部分地区一直都是 EST。我是否应该使用“美国东部标准时间”以外的其他时间来表示印第安纳州不遵守 DST 的那些部分?

Dim timeZones As New List(Of String)()
With timeZones
    .Add("Eastern Standard Time")   ' Eastern TZ, except parts of Indiana
    .Add("US Eastern Standard Time")    ' parts of Indiana?
End With

For Each tz In timeZones
    Dim tzi As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(tz)
    buf.AppendLine(tz)
    buf.AppendFormat("SupportsDaylightSavingTime: {0}", tzi.SupportsDaylightSavingTime).AppendLine()
    buf.AppendFormat("DisplayName: {0}", tzi.DisplayName).AppendLine()
    buf.AppendFormat("StandardName: {0}", tzi.StandardName).AppendLine()
    buf.AppendFormat("DaylightName: {0}", tzi.DaylightName).AppendLine()
    buf.AppendFormat("IsDaylightSavingTime: {0}", tzi.IsDaylightSavingTime(DateTime.Now)).AppendLine()
    buf.AppendFormat("Current Local Time: {0}", TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi)).AppendLine()
    buf.AppendFormat("Current UTC Time: {0}", DateTime.UtcNow).AppendLine()
    buf.AppendLine()
Next

结果:

Eastern Standard Time
SupportsDaylightSavingTime: True
DisplayName: (UTC-05:00) Eastern Time (US & Canada)
StandardName: Eastern Standard Time
DaylightName: Eastern Daylight Time
IsDaylightSavingTime: True
Current Local Time: 4/26/2012 10:37:08 AM
Current UTC Time: 4/26/2012 2:37:08 PM

US Eastern Standard Time
SupportsDaylightSavingTime: True
DisplayName: (UTC-05:00) Indiana (East)
StandardName: US Eastern Standard Time
DaylightName: US Eastern Daylight Time
IsDaylightSavingTime: True
Current Local Time: 4/26/2012 10:37:08 AM
Current UTC Time: 4/26/2012 2:37:08 PM
4

1 回答 1

1

根据维基百科“印第安纳州现在几点”,整个印第安纳州现在都在遵守夏令时 - 但无论是在中部时间还是东部时间。

所以没有“在印第安纳州的一次”,但它在任何地方都观察到某种形式的夏令时。如果您在 2005 年之前返回(ish - 上面的页面对我来说不是很清楚),您可能会也可能不会发现 Windows 时区数据库正确地模拟了历史。我希望tzdb 数据库有更完整的信息......它有几个不同的基于印第安纳州的时区 ID(例如 America/Indiana/Knox、America/Indiana/Petersburg 等)

于 2012-04-26T14:46:02.050 回答