TimeZone.IsDaylightSavingTime
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic
Module DaylightTimeDemo
Sub Main( )
Dim localZone As TimeZone = TimeZone.CurrentTimeZone
Dim localTime As DateTime = new DateTime( 2001, 1, 1 )
Dim daylight2001 As DaylightTime = localZone.GetDaylightChanges( 2001 )
Dim daylight2002 As DaylightTime = localZone.GetDaylightChanges( 2002 )
Dim loopX As Integer
For loopX = 0 to 10
Dim utcTime As DateTime = localZone.ToUniversalTime( localTime )
Console.WriteLine( "{0,-22:yyyy-MM-dd HH:mm}" & _
"{1,-10}{2,-10}{3,-10}{4:yyyy-MM-dd HH:mm}", _
localTime, _
TimeZone.IsDaylightSavingTime(localTime, daylight2001 ), _
TimeZone.IsDaylightSavingTime(localTime, daylight2002 ), _
localZone.IsDaylightSavingTime( localTime ),utcTime )
localTime = localTime.AddDays( 109.1 )
Next loopX
End Sub
End Module
Related examples in the same category