VB.Net by API/System/TimeZone

Материал из VB Эксперт
Версия от 12:51, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

TimeZone.DaylightName

  

Public Class Tester
    Public Shared Sub Main
        Dim theZone As TimeZone = TimeZone.CurrentTimeZone
        Dim result As New System.Text.StringBuilder
        result.Append("DaylightName: ").AppendLine( _
           theZone.DaylightName)
        result.Append("StandardName: ").AppendLine( _
           theZone.StandardName)
        result.Append("IsDaylightSavingTime(Now): ").AppendLine( _
           theZone.IsDaylightSavingTime(Now))
        result.Append("GetUtcOffset(Now): ").AppendLine( _
           theZone.GetUtcOffset(Now).ToString())
        result.Append("System time is Local Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Local)
        result.Append("System time is Universal Coordinated Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Utc)
        result.Append("System time is Unspecified: ")
        result.AppendLine(Now.Kind = DateTimeKind.Unspecified)
        Console.WriteLine(result.ToString())
    End Sub
End Class


TimeZone.GetUtcOffset

  
Public Class Tester
    Public Shared Sub Main
        Dim theZone As TimeZone = TimeZone.CurrentTimeZone
        Dim result As New System.Text.StringBuilder
        result.Append("DaylightName: ").AppendLine( _
           theZone.DaylightName)
        result.Append("StandardName: ").AppendLine( _
           theZone.StandardName)
        result.Append("IsDaylightSavingTime(Now): ").AppendLine( _
           theZone.IsDaylightSavingTime(Now))
        result.Append("GetUtcOffset(Now): ").AppendLine( _
           theZone.GetUtcOffset(Now).ToString())
        result.Append("System time is Local Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Local)
        result.Append("System time is Universal Coordinated Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Utc)
        result.Append("System time is Unspecified: ")
        result.AppendLine(Now.Kind = DateTimeKind.Unspecified)
        Console.WriteLine(result.ToString())
    End Sub
End Class


TimeZone.IsDaylightSavingTime

  
Public Class Tester
    Public Shared Sub Main
        Dim theZone As TimeZone = TimeZone.CurrentTimeZone
        Dim result As New System.Text.StringBuilder
        result.Append("DaylightName: ").AppendLine( _
           theZone.DaylightName)
        result.Append("StandardName: ").AppendLine( _
           theZone.StandardName)
        result.Append("IsDaylightSavingTime(Now): ").AppendLine( _
           theZone.IsDaylightSavingTime(Now))
        result.Append("GetUtcOffset(Now): ").AppendLine( _
           theZone.GetUtcOffset(Now).ToString())
        result.Append("System time is Local Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Local)
        result.Append("System time is Universal Coordinated Time: ")
        result.AppendLine(Now.Kind = DateTimeKind.Utc)
        result.Append("System time is Unspecified: ")
        result.AppendLine(Now.Kind = DateTimeKind.Unspecified)
        Console.WriteLine(result.ToString())
    End Sub
End Class