本文整理匯總了VB.NET中System.DateTime.Equals方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTime.Equals方法的具體用法?VB.NET DateTime.Equals怎麽用?VB.NET DateTime.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.DateTime
的用法示例。
在下文中一共展示了DateTime.Equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1:
Dim today1 As New System.DateTime(System.DateTime.Today.Ticks)
Dim today2 As New System.DateTime(System.DateTime.Today.Ticks)
Dim tomorrow As New System.DateTime( _
System.DateTime.Today.AddDays(1).Ticks)
' todayEqualsToday gets true.
Dim todayEqualsToday As Boolean = System.DateTime.Equals(today1, today2)
' todayEqualsTomorrow gets false.
Dim todayEqualsTomorrow As Boolean = System.DateTime.Equals(today1, tomorrow)
示例2: Application
Module Application
Sub Main()
' Create some DateTime objects.
Dim one As DateTime = DateTime.UtcNow
Dim two As DateTime = DateTime.Now
Dim three As DateTime = one
' Compare the DateTime objects and display the results.
Dim result As Boolean = one.Equals(two)
Console.WriteLine("The result of comparing DateTime object one and two is: {0}.", result)
result = one.Equals(three)
Console.WriteLine("The result of comparing DateTime object one and three is: {0}.", result)
End Sub
End Module
' This code example displays the following:
'
' The result of comparing DateTime object one and two is: False.
' The result of comparing DateTime object one and three is: True.