VB.Net by API/System/TimeZone

Материал из VB Эксперт
Перейти к: навигация, поиск

TimeZone.DaylightName

<source lang="vbnet">

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


 </source>


TimeZone.GetUtcOffset

<source lang="vbnet"> 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


 </source>


TimeZone.IsDaylightSavingTime

<source lang="vbnet"> 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


 </source>