TimeZone.IsDaylightSavingTime : TimeZone « Date Time « VB.Net






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

1.TimeZone.GetUtcOffset Method returns the Coordinated Universal Time (UTC) offset for the specified local time.
2.TimeZone.GetDaylightChanges returns the daylight saving time period for a particular year.
3.TimeZone.GetUtcOffset returns the Coordinated Universal Time (UTC) offset for the specified local time.
4.TimeZone.ToLocalTime returns the local time that corresponds to a specified date and time value.