Friday, August 1, 2014

How to check or compare that two dates, not including time, are equal? in Asp.net

A very simple example of comparing two dates without including time as below:

One Way:
Dim date1 As Date = CDate("8/1/2014 11:00:00 PM")
Dim date2 As Date = CDate("8/1/2014 02:25:15 AM")

Dim result As Boolean = date1.Date.Equals(date2.Date)
'Result: True


Second Way:
Dim date1 As Date = CDate("8/1/2014 11:00:00 PM").ToShortDateString()
Dim date2 As Date = CDate("8/1/2014 02:25:15 AM").ToShortDateString()

Dim result As Boolean = Date.Equals(date1, date2)
'Result: True 


No comments:

Post a Comment

React-select is very slow on larger list - Found solution - using react-window

 I had more than 4000 items in searchable dropdownlist. I have used react-select but it was very slow. finally I found complete solution to ...