read only date and compare two dates in C# code example
Example 1: how to compare datetime in c#
DateTime.Compare(datetime1, datetime2);
/*
datetime1 before datetime2 = -ve
datetime1 equal datetime2 = 0
datetime1 after datetime2 = +ve
*/
Example 2: c# how to compare 2 dates without time
if(dateTime1.Date == dateTime2.Date)
// or
if (dateTime1.Date.CompareTo(dateTime2.Date))
{
}