本文整理汇总了VB.NET中System.DateTimeOffset.LocalDateTime属性的典型用法代码示例。如果您正苦于以下问题:VB.NET DateTimeOffset.LocalDateTime属性的具体用法?VB.NET DateTimeOffset.LocalDateTime怎么用?VB.NET DateTimeOffset.LocalDateTime使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.DateTimeOffset
的用法示例。
在下文中一共展示了DateTimeOffset.LocalDateTime属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: DateTimeOffset
Dim dto As DateTimeOffset
' Current time
dto = DateTimeOffset.Now
Console.WriteLine(dto.LocalDateTime)
' UTC time
dto = DateTimeOffset.UtcNow
Console.WriteLine(dto.LocalDateTime)
' Transition to DST in local time zone occurs on 3/11/2007 at 2:00 AM
dto = New DateTimeOffset(#03/11/2007 3:30AM#, New Timespan(-7, 0, 0))
Console.WriteLine(dto.LocalDateTime)
dto = New DateTimeOffset(#03/11/2007 2:30AM#, New Timespan(-7, 0, 0))
Console.WriteLine(dto.LocalDateTime)
' Invalid time in local time zone
dto = New DateTimeOffset(#03/11/2007 2:30AM#, New Timespan(-8, 0, 0))
Console.WriteLine(TimeZoneInfo.Local.IsInvalidTime(dto.DateTime))
Console.WriteLine(dto.LocalDateTime)
' Transition from DST in local time zone occurs on 11/4/07 at 2:00 AM
' This is an ambiguous time
dto = New DateTimeOffset(#11/4/2007 1:30AM#, New TimeSpan(-7, 0, 0))
Console.WriteLine(TimeZoneInfo.Local.IsAmbiguousTime(dto))
Console.WriteLine(dto.LocalDateTime)
dto = New DateTimeOffset(#11/4/2007 2:30AM#, New TimeSpan(-7, 0, 0))
Console.WriteLine(TimeZoneInfo.Local.IsAmbiguousTime(dto))
Console.WriteLine(dto.LocalDateTime)
' This is also an ambiguous time
dto = New DateTimeOffset(#11/4/2007 1:30AM#, New TimeSpan(-8, 0, 0))
Console.WriteLine(TimeZoneInfo.Local.IsAmbiguousTime(dto))
Console.WriteLine(dto.LocalDateTime)
' If run on 3/8/2007 at 4:56 PM, the code produces the following
' output:
' 3/8/2007 4:56:03 PM
' 3/8/2007 4:56:03 PM
' 3/11/2007 3:30:00 AM
' 3/11/2007 1:30:00 AM
' True
' 3/11/2007 3:30:00 AM
' True
' 11/4/2007 1:30:00 AM
' 11/4/2007 1:30:00 AM
' True
' 11/4/2007 1:30:00 AM