Vb.net 欧洲/都柏林的非实时DST问题

Vb.net 欧洲/都柏林的非实时DST问题,vb.net,datetime,nodatime,Vb.net,Datetime,Nodatime,我正在尝试两种不同的方法来使用NodaTime确定夏令时: now=SystemClock.Instance.GetCurrentInstant Dim nowInIsoUtc As String=now.InUtc.ToString(“yyyy-MM-dd HH:MM:ss”,CultureInfo.InvariantCulture) Dim localTimeZone As DateTimeZone=DateTimeZoneProviders.Tzdb(ComboBox1.SelectedI

我正在尝试两种不同的方法来使用NodaTime确定夏令时:

now=SystemClock.Instance.GetCurrentInstant
Dim nowInIsoUtc As String=now.InUtc.ToString(“yyyy-MM-dd HH:MM:ss”,CultureInfo.InvariantCulture)
Dim localTimeZone As DateTimeZone=DateTimeZoneProviders.Tzdb(ComboBox1.SelectedItem.ToString)
Dim nowInLocal As String=now.InZone(localTimeZone).ToString(“yyyy-MM-dd HH:MM:ss”,CultureInfo.InvariantCulture)
Dim DST作为布尔值=now.InZone(localTimeZone).IsDaylightSavingTime
Dim间隔为ZoneInterval=localTimeZone.GetZoneInterval(现在)
Dim DSTART As Instant=间隔。开始
Dim DstEnd作为瞬间=间隔。结束
'获取此时段的夏令时值
作为偏移量的节省=间隔。节省
'获取此期间的标准偏移量,无任何夏令时供款
将标准偏移量标注为偏移量=间隔.StandardOffset
Tb1.AppendText(“UTC中的当前日期时间:&nowInIsoUtc&vbCrLf)
Tb1.AppendText(“本地时间中的当前日期时间:&nowInLocal&vbCrLf)
Tb1.AppendText(“本地时区:”&localTimeZone.ToString&vbCrLf)
Tb1.AppendText(“夏令时数:&dststavings.ToString&vbCrLf)
Tb1.AppendText(“StandardOffset:”&StandardOffset.ToString&vbCrLf)
Tb1.追加文本(“DST:&DST.ToString&.”从“&DstStart.ToString&”到“&DstEnd.ToString&vbCrLf”)

Dim SelectedZone As DateTimeZone=DateTimeZoneProviders.Tzdb(ComboBox1.SelectedItem.ToString)
Dim clock As ZonedClock=SystemClock.Instance.InZone(SelectedZone)
将ThisDate设置为LocalDate=clock.GetCurrentDate()
将此时间调暗为LocalTime=clock.GetCurrentTimeOfDay
Dim DST作为布尔值=clock.GetCurrentZonedDateTime.IsDaylightSavingTime
Tb1.AppendText(“选定区域中的日期时间:”&SelectedZone.ToString&vbCrLf)
Tb1.AppendText(“日期:&ThisDate.ToString&”,时间:&ThisTime.ToString&“DST:&DST&vbCrLf”)
当使用“欧洲/都柏林”和“欧洲/伦敦”作为时区时,我得到了相互矛盾的结果:

METHOD A:
Current DateTime in UTC: 2020-07-29 08:46:27

Current DateTime in Local Time: 2020-07-29 09:46:27
Local TimeZone: Europe/Dublin
Amount of Daylight Savings in hours: +00
StandardOffset: +01
DST: False. From 2020-03-29T01:00:00Z to 2020-10-25T01:00:00Z

Current DateTime in UTC: 2020-07-29 08:46:46
Current DateTime in Local Time: 2020-07-29 09:46:46
Local TimeZone: Europe/London
Amount of Daylight Savings in hours: +01
StandardOffset: +00
DST: True. From 2020-03-29T01:00:00Z to 2020-10-25T01:00:00Z

这两种方法似乎都表明都柏林没有夏令时,尽管两种方法都给出了相同的DST开始和结束日期/时间。对此有什么想法吗?

结果是正确的——这是爱尔兰时区的一个奇怪现象。目前爱尔兰没有实行夏令时。其标准偏移量为UTC+1

2020年10月25日,爱尔兰将进入“夏令时”,夏令时偏移量为-1小时。因此,如果您将测试改为11月的某个日期(比如),您将看到欧洲/都柏林显示DST:True,而欧洲/伦敦显示DST:False

自1968年以来,爱尔兰一直是这样。以下是评论中的相关信息:


真奇怪!!我住在爱尔兰,从来都不知道!!谢谢你的解释。
METHOD B:
DateTime in selected Zone: Europe/Dublin
Date: Wednesday, 29 July, 2020, Time: 09:47:03 DST: False

DateTime in selected Zone: Europe/London
Date: Wednesday, 29 July, 2020, Time: 09:47:09 DST: True
# (Note that the time in the Republic of Ireland since 1968 has been defined
# in terms of standard time being GMT+1 with a period of winter time when it
# is GMT, rather than standard time being GMT with a period of summer time
# being GMT+1.)