The format matters when you parse a string to a DateTime object. Once you have done that and you have two DateTime objects then comparing their Date properties is the correct thing to do. The Date properties return DateTime objects with time set to 12:00am

In order to parse the date correctly you can pass a IFormatProvider to the DateTime.Parse() method. E.g. a CultureInfo object:

DateTime d = DateTime.Parse("07/04/2011", CultureInfo.GetCultureInfo("en-us"));


Can this link help you?

How to compare dates in LINQ?

where t.CreateDate.Date < DateTime.Today.AddMonths(-1)


The thing is that you will rarely compare dates in a specific format(unless you want to compare them as strings or something). Thus is the introduction of the DateTime structure.

Anyway the most used way of comparing dates is not to check for equality but to actually check whether a date comes into a specific range. For example:

startDate <= order.OrderDate && order.OrderDate < endDate

Related Query

More Query from same tag