How to get the number of days between two dates, excluding weekends?
Posted on 2006-05-18
I've searched and a found a couple of suggestions that didn't work for me.
I can get the amount of days with the weekends included in the count. I can't seem to figure out how to get the number of days without the weekends.
DateTime dt1 = Convert.ToDateTime(FirstDayOut.Text);
DateTime dt2 = Convert.ToDateTime(WillReturn.Text);
TimeSpan ts = dt2.Subtract(dt1);
int days = ts.Days;
txtDate.Text = days.ToString();
This is very urgent.
Any help would be great.