I want to compare just the date part (and Not the time) of two VB.NET Date objects. Is there a way to do that?
CompareTo(DateOnly) Compares the value of this instance to a specified DateOnly value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
Often you may want to compare two dates in Excel while ignoring the time values associated with the dates. Fortunately you can use the INT() function in Excel to extract just the date from a datetime value, which allows you to easily compare dates while ignoring the time.
Just take the date part of each via the Date
property and compare the two:
date1.Date.CompareTo(date2.Date)
Or:
If date1.Date < date2.Date Then
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With