Please see my comment to the question. Yes, it's "subtract" and also
System.TimeSpan
. Use subtraction properly:
System.DateTime before =
System.DateTime after =
System.TimeSpan interval = before - after;
The further code depends on what you mean by the meaning of "number of days". If you think about it, you may understand that these words are ambiguous. But, for example,
int numberOfDays = interval.Days;
double intervalInDays = interval.TotalDays;
Please see:
DateTime Structure (System)[
^],
TimeSpan Structure (System)[
^].
Member 12133159 wrote:
I already visited these links...
Everything is working but the only problem is I have Dates in TextBoxes...
Read on the methods named as
System.DateTime.*Parse*
; the link is shown above.
—SA