our new blog site : http://blog.hintechnology.com
public static int WeekCount(DateTime startDate, DateTime endDate, DayOfWeek Week)
{
// Number of days between start date and end date
int _noOfDays = (endDate - startDate).Days;
// days between week of start date
int _adjustingDays = (7 + (int)Week - (int)startDate.DayOfWeek) % 7;
// days remain after total days after dividing 7
int _remainDays = _noOfDays % 7;
int _totalWeekTurns = (_noOfDays) / 7;
int _addTurns = _remainDays >= _remainDays ? 1 : 0;
return _totalWeekTurns + _addTurns;
}
No comments:
Post a Comment