Reputation: 487
i have two textbox using calaendarExtender and one label.
My needed is if i select two different 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......
Upvotes: 1
Views: 3149
Reputation: 57996
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();
Upvotes: 1