本文整理匯總了VB.NET中System.TimeZoneInfo.FindSystemTimeZoneById方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET TimeZoneInfo.FindSystemTimeZoneById方法的具體用法?VB.NET TimeZoneInfo.FindSystemTimeZoneById怎麽用?VB.NET TimeZoneInfo.FindSystemTimeZoneById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了TimeZoneInfo.FindSystemTimeZoneById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
Module Example
Public Sub Main()
' Get time in local time zone
Dim thisTime As Date = Date.Now
Console.WriteLine("Time in {0} zone: {1}", IIf(TimeZoneInfo.Local.IsDaylightSavingTime(thisTime),
TimeZoneInfo.Local.DaylightName, TimeZoneInfo.Local.StandardName), thisTime)
Console.WriteLine(" UTC Time: {0}", TimeZoneInfo.ConvertTimeToUtc(thisTime, TimeZoneInfo.Local))
' Get Tokyo Standard Time zone
Dim tst As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time")
Dim tstTime As Date = TimeZoneInfo.ConvertTime(thisTime, TimeZoneInfo.Local, tst)
Console.WriteLine("Time in {0} zone: {1}", IIf(tst.IsDaylightSavingTime(tstTime),
tst.DaylightName, tst.StandardName), tstTime)
Console.WriteLine(" UTC Time: {0}", TimeZoneInfo.ConvertTimeToUtc(tstTime, tst))
End Sub
End Module
' The example displays output like the following when run on a system in the U.S.
' Pacific Standard Time zone:
' Time in Pacific Standard Time zone: 12/6/2013 10:57:51 AM
' UTC Time: 12/6/2013 6:57:51 PM
' Time in Tokyo Standard Time zone: 12/7/2013 3:57:51 AM
' UTC Time: 12/6/2013 6:57:51 PM