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