VB.Net by API/System/TimeZone
Версия от 16:40, 26 мая 2010; (обсуждение)
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