![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
/// <summary> /// 用来获取工作日(不含周六周日) /// </summary> /// <param name="dtSub">公文收文日期</param> /// <param name="countday">工作总天数</param> /// <param name="weekday">工作日(初始为0)</param> /// <returns>工作日</returns> private static int GetDaysOfNoWeekend(DateTime dtSub, int countday, int weekday) { for (int i = 0; i < countday; i++) { DateTime tempdt = dtSub.Date.AddDays(i); if (tempdt.DayOfWeek != System.DayOfWeek.Saturday && tempdt.DayOfWeek != System.DayOfWeek.Sunday) { weekday++; } } return weekday; }