本文整理汇总了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