print?/// <summary>
/// 獲取日期段裡的工作日【除去 周六、日】
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public static long dateDiff(String startDate, String endDate)
{
DateTime fromTime = CommonFunc.StringToDate(startDate);
DateTime toTime = CommonFunc.StringToDate(endDate);
TimeSpan ts = toTime.Subtract(fromTime);//TimeSpan得到fromTime和toTime的時間間隔
long countday = ts.Days;//獲取兩個日期間的總天數
long weekday = 0;//工作日
//循環用來扣除總天數中的雙休日
for (int i = 0; i < countday; i++)
{
DateTime tempdt = fromTime.Date.AddDays(i + 1);
if (tempdt.DayOfWeek != System.DayOfWeek.Saturday && tempdt.DayOfWeek != System.DayOfWeek.Sunday)
{
weekday++;
}
}
return weekday;