I am trying to find days between two dates using a Time span.
nextdate1='2014-12-20'
today `='2014-12-18'`
My sample code is:
DateTime nexdate1 = dr.GetDateTime(2); //gets from database. I checked and the value is correct
DateTime today = DateTime.Now;
TimeSpan nextdate = nexdate1.Subtract(today);
int difference = nextdate.Days;
Now I get difference=1
. Actually the difference is 2 (20-18)
.
Why it shows difference as 1?