how to calculate the working days in between two different dates in asp.net
i have two textbox using calaendarExtender and one label.
My needed is if i select two diff开发者_开发百科erent dates in calendar extender the number of working days(excluding Sunday) to be automatically display in the label.
can any one help me..... im new in ASP.net......
What about this:
DateTime start = new DateTime(2010, 12, 1);
DateTime end = new DateTime(2010, 12, 31);
int workdays = 0;
DateTime aux = start;
while(aux <= end)
{
aux = aux.AddDays(1);
if (aux.DayOfWeek != DayOfWeek.Sunday)
workdays++;
}
yourLabel.Text = workdays.ToString();
精彩评论