为什么 .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