I have 2 textboxes with 2 ajax calendars.One is start date and the other is end date. I'm trying to find the days between them but I can't seem to get it right.This is how I do it:
string a = txt1.Text;
string b = txt2.Text;
DateTime data1 = Convert.ToDateTime(a);
DateTime data2 = Convert.ToDateTime(b);
TimeSpan span = data2 - data1;
int zile = Convert.ToInt32(Math.Ceiling(span.TotalDays));
label.Text = span.ToString();
The dates from my textboxes are in this format: 4/4/2012 and 4/5/2012. This should be one day difference but when I run this code it brings up 30 day because it's interpreted as one month..How can I change that???