I am trying two different methods to determine Daylight Savings Time with 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 As Boolean = now.InZone(localTimeZone).IsDaylightSavingTime
Dim interval As ZoneInterval = localTimeZone.GetZoneInterval(now)
Dim DstStart As Instant = interval.Start
Dim DstEnd As Instant = interval.End
' Gets the Daylight Savings value for this period
Dim DstSavings As Offset = interval.Savings
' Gets the Standard Offset for this period without any Daylight Savings contributions
Dim StandardOffset As Offset = interval.StandardOffset
Tb1.AppendText("Current DateTime in UTC: " & nowInIsoUtc & vbCrLf)
Tb1.AppendText("Current DateTime in Local Time: " & nowInLocal & vbCrLf)
Tb1.AppendText("Local TimeZone: " & localTimeZone.ToString & vbCrLf)
Tb1.AppendText("Amount of Daylight Savings in hours: " & DstSavings.ToString & vbCrLf)
Tb1.AppendText("StandardOffset: " & StandardOffset.ToString & vbCrLf)
Tb1.AppendText("DST: " & DST.ToString & ". From " & DstStart.ToString & " to " & DstEnd.ToString & vbCrLf)
and
Dim SelectedZone As DateTimeZone = DateTimeZoneProviders.Tzdb(ComboBox1.SelectedItem.ToString)
Dim clock As ZonedClock = SystemClock.Instance.InZone(SelectedZone)
Dim ThisDate As LocalDate = clock.GetCurrentDate()
Dim ThisTime As LocalTime = clock.GetCurrentTimeOfDay
Dim DST As Boolean = clock.GetCurrentZonedDateTime.IsDaylightSavingTime
Tb1.AppendText("DateTime in selected Zone: " & SelectedZone.ToString & vbCrLf)
Tb1.AppendText("Date: " & ThisDate.ToString & ", Time: " & ThisTime.ToString & " DST: " & DST & vbCrLf)
When using 'Europe/Dublin' and 'Europe/London' as the timezones, I get conflicting results:
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
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
Both methods appear to say that there is no Daylight Savings Time in Dublin, even though identical DST Start and End date/times are given for both. Any thoughts on this, please?