VB.Net program to demonstrate the Equals() method of DateTime class
'VB.NET program to demonstrate Equals() method of DateTime class.
Imports System
Module Module1
Sub Main()
Dim date1 As New DateTime(2020, 4, 27)
Dim date2 As New DateTime(2021, 3, 28)
Dim date3 As New DateTime(2021, 3, 28)
Dim ret As Boolean = False
ret = DateTime.Equals(date1, date2)
If (ret = True) Then
Console.WriteLine("{0} and {1} are equal", date1, date2)
Else
Console.WriteLine("{0} and {1} are not equal", date1, date2)
End If
ret = DateTime.Equals(date2, date3)
If (ret = True) Then
Console.WriteLine("{0} and {1} are equal", date2, date3)
Else
Console.WriteLine("{0} and {1} are not equal", date2, date3)
End If
End Sub
End Module
27-04-2020 00:00:00 and 28-03-2021 00:00:00 are not equal
28-03-2021 00:00:00 and 28-03-2021 00:00:00 are equal
Press any key to continue . . .
Table of Contents