Please see my comment to the question. It is not clear what you are trying to achieve. I can only answer how to skip some days, but it will work only if if you have some loop where some variable (loop variable) are actually assigned to the time with the day of weeks to be skipped, for example, if you increment by one day or less.
Not sure if you want that, but to illustrate just the "jump", it could be anything like
System.DateTime currentDate =
System.DateTime finalDate =
while (currentDate <= finalDate) {
if (currentDate.DayOfWeek == System.DayOfWeek.Saturday ||
currentDate.DayOfWeek == System.DayOfWeek.Sunday)
continue;
DoSomethingWithYourTime(currentDate);
currentDate = IncrementTimeSomehow(currentDate);
}
I hope you got the idea, not apply some logic. If you just need to count days not counting weekends (I'm not sure), you would need to count number of full weeks and multiply by 5. At the beginning and the end, you can have incomplete weeks, for them, you would need to check if Sunday or Saturday fall in the interval of each of incomplete weeks, so you will need to subtract 0, 1 or two days from each. If you deal with just few days (say, a month of few month, an year), just iterating by one day could be simpler. Just use logic.
—SA