Whatever code provided you above in that you are compairing two Date values with each other.For that you can use :
Dim d1 As DateTime = New DateTime(Year, Month, Day, Hour, Minute, Second)
Dim d2 As DateTime = New DateTime(Year, Month, Day, Hour, Minute, Second)
MessageBox.Show(DateTime.Compare(d1, d2))
It return -1 if d1 is less than d2,1 if d1 is greater than d2 and 0 if both are equal.