CSharp examples for System:DateTime Day
Business Days To
using System;//from ww w .jav a 2 s . c om public class Main{ public static int BusinessDaysTo(this DateTime fromDate, DateTime toDate) { var ret = -1; var dt = fromDate; while (dt < toDate) { if (dt.IsBusinessDay()) { ret++; } dt = dt.AddDays(1); } return ret; } public static bool IsBusinessDay(this DateTime date) { return date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday; } }