Hi guys i’m trying to compare two dates, for some reason the following code will return false, if i specify 25/05/2012 (startdate) and 31/05/12 (end date).
This only happens if 25th is used as the start date, works fine if i use 26th.
public bool IsValidDate(DateTime startDate, DateTime endDate)
{
return startDate < endDate && endDate > startDate;
}
what could be wrong?
You must be mistaken something. For the given input you specified this code returns
true:Prints
trueon the console.Now of course repeating the exact same condition twice is meaningless. Stating the condition once is more than enough: