本文整理匯總了VB.NET中System.DateTime.FromBinary方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTime.FromBinary方法的具體用法?VB.NET DateTime.FromBinary怎麽用?VB.NET DateTime.FromBinary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.DateTime
的用法示例。
在下文中一共展示了DateTime.FromBinary方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
Module Example
Public Sub Main()
Dim localDate As Date = DateTime.SpecifyKind(#03/14/2010 2:30AM#, DateTimeKind.Local)
Dim binLocal As Long = localDate.ToBinary()
If TimeZoneInfo.Local.IsInvalidTime(localDate) Then
Console.WriteLine("{0} is an invalid time in the {1} zone.", _
localDate, _
TimeZoneInfo.Local.StandardName)
End If
Dim localDate2 As Date = DateTime.FromBinary(binLocal)
Console.WriteLine("{0} = {1}: {2}", _
localDate, localDate2, localDate.Equals(localDate2))
End Sub
End Module
輸出:
3/14/2010 2:30:00 AM is an invalid time in the Pacific Standard Time zone. 3/14/2010 2:30:00 AM = 3/14/2010 3:30:00 AM: False