compare two dates?

  • Thread starter Thread starter Dirk Reske
  • Start date Start date
D

Dirk Reske

Hello,

I have two dates.
How can I check if the second date is the day after the first date?

thx
 
I think this way will do what he need ..

if (DateTime.Compare(date1, date2) > 0) Console.Write("date1 > date2");
if (DateTime.Compare(date1, date2) == 0) Console.Write("date1 == date2");
if (DateTime.Compare(date1, date2) < 0) Console.Write("date1 < date2");

Nirosh.
 
Dirk Reske said:
Hello,

I have two dates.
How can I check if the second date is the day after the first date?

The DateTime struct supports the >, <=, >= and < operators.
 
Back
Top