I am new to c#. Now i m currently working in a leave system project, in this i have two popup calendar to select the leave-start date and leave-end date for employee. If employee select more than 5 days, weekend dates should not be calculate as a leave credit. I m using the following code to find the difference.
DateTime dt = Convert.ToDateTime(txtfrmdate.SelectedDate.ToShortDateString()); DateTime dt1 = Convert.ToDateTime(txtenddate.SelectedDate.ToShortDateString()); TimeSpan diff = dt1.Subtract(dt); int days = diff.Days + 1;
In this if we select dates 11/26/2009 to 12/2/2009, result will be 7. here the weekend dates also calculated. But i want to ignore the weekend days.
Please can any one help me how to do this.