Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m designing a batch scheduling application.. .

In that the batch can be scheduled on everyday basis
or
only for specific days...

and each batch runs for only specific no. of days

if it is for specific days than i need to generate the End Date of the Batch according to the "duration in days" of the batch excluding the other days....


Can anyone help... :)

Thanks :)
Posted

1 solution

DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddDays(10);
int count = 0;
while(startDate < endDate)
{
    if(startDate.DayOfWeek != DayOfWeek.Sunday)
    {
        count++;
    }
    startDate = startDate.AddDays(1);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900