Added an excluded time by start, end times and the days.

        ``start`` and ``end`` are in military integer times (e.g. - 1200 1430).
        ``days`` is a collection of integers or strings of fully-spelt, lowercased days
                 of the week.
519224
def exclude_time(self, start, end, days):
        
        self._excluded_times.append(TimeRange(start, end, days))
        return self
962271
def _calc_daystamps(self, st_time, end_time):
        
        start_doy = sum(self._num_of_days_each_month[:st_time.month-1]) + st_time.day
        end_doy = sum(self._num_of_days_each_month[:end_time.month-1]) + end_time.day + 1
        return list(range(start_doy, end_doy))
986285
def all_days(boo):
  
  earliest = datetime.strptime(('2015-11-12').replace('-', ' '), '%Y %m %d')
  latest = datetime.strptime(datetime.today().date().isoformat().replace('-', ' '), '%Y %m %d')
  num_days = (latest - earliest).days + 1
  all_days = [latest - timedelta(days=x) for x in range(num_days)]
  all_days.reverse()

  output = []

  if boo:
    # Return as Integer, yyyymmdd
    for d in all_days:
      output.append(int(str(d).replace('-', '')[:8]))
  else:
    # Return as String, yyyy-mm-dd
    for d in all_days:
      output.append(str(d)[:10])
  return output
1055023
Duration addDays(final int amount) {
        Duration duration;
        if (amount < 0) {
            duration = getDatatypeFactory().newDuration(false, 0, 0, Math.abs(amount), 0, 0, 0);
        } else {
            duration = getDatatypeFactory().newDuration(true, 0, 0, amount, 0, 0, 0);
        }
        return duration;
    }
261774
def get_week_start_end_day():
    
    t = date.today()
    wd = t.weekday()
    return (t - timedelta(wd), t + timedelta(6 - wd))
801486
def duration(start, end=None):
    
    if not end:
        end = datetime.now()
    td = end - start
    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1000000) \
        / 1000000.0
589569
public static int getPeriodDays(Date start, Date end) {
		try {
			start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start));
			end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end));
			Calendar cal = Calendar.getInstance();
			cal.setTime(start);
			long time1 = cal.getTimeInMillis();
			cal.setTime(end);
			long time2 = cal.getTimeInMillis();
			long between_days = (time2 - time1) / (1000 * 3600 * 24);
			return Integer.parseInt(String.valueOf(between_days));
		} catch (Exception e) {
			throw new KnifeUtilsException(e);
		}
	}
1047505
function getDays(start, end = moment().startOf('day')) {
  let cursor = moment(start);
  let days = [];
  while (cursor.isBefore(end)) {
    days.push(cursor.format('YYYY-MM-DD'));
    cursor = cursor.add(1, 'd');
  }
  return days;
}
241483
def include?(date)
    return true if all_week?
    if @start_day < @end_day
      @start_day<=date.wday && @end_day>=date.wday
    else
      (@start_day<=date.wday && 6 >=date.wday) || (0 <=date.wday && @end_day >=date.wday)
    end
  end
1009086
public static function diffDays($start, $end) {
        if (!is_string($start))                      throw new IllegalTypeException('Illegal type of parameter $start: '.gettype($start));
        if (Validator::isDateTime($start) === false) throw new InvalidArgumentException('Invalid argument $start: "'.$start.'"');
        if (!is_string($end))                        throw new IllegalTypeException('Illegal type of parameter $end: '.gettype($end));
        if (Validator::isDateTime($end) === false)   throw new InvalidArgumentException('Invalid argument $end: "'.$end.'"');

        $ts1 = strtotime($start.' GMT'); // ohne Angabe einer Zeitzone wird die lokale DST einkalkuliert
        $ts2 = strtotime($end.' GMT');

        $diff = $ts2 - $ts1;

        if ($diff % DAYS)
            Logger::log('('.$ts2.'-'.$ts1.') % DAYS != 0: '.($diff%DAYS), L_WARN);

        return (int)($diff / DAYS);
    }
1157575
def is_days_ago(adatetime, days):
    
    if days == 1:
        end_time = last_midnight()
        start_time = end_time - timedelta(days=1)
    else:
        start_time = last_midnight() - timedelta(days=days)
        end_time = start_time + timedelta(days=1)
    return start_time <= adatetime <= end_time
704968
def scheduled_special_times(calendar, start, end, time, tz):
    
    days = calendar.holidays(start, end)
    return pd.Series(
        index=pd.DatetimeIndex(days, tz=UTC),
        data=days_at_time(days, time, tz=tz),
    )
228590
def get_end_of_day(year, month, day):
    
    # DST is not known in the provided date
    timestamp = time.mktime((year, month, day, 23, 59, 59, 0, 0, -1))
    return int(timestamp)
364506
def days(self):
        """"""
        monday = self.day(0)
        return [monday + timedelta(days=i) for i in range(7)]
893912
public boolean isIn(Date beginDate, Date endDate) {
		long beginMills = beginDate.getTime();
		long endMills = endDate.getTime();
		long thisMills = this.getTime();

		return thisMills >= Math.min(beginMills, endMills) && thisMills <= Math.max(beginMills, endMills);
	}
641624
def fix_mispelled_day(cls, timestr):
        
        day_extraction = cls.START_WITH_DAY_OF_WEEK.match(timestr)
        if day_extraction is not None:
            day = day_extraction.group(1).lower()
            if len(day) == 3:
                dataset = DAYS_ABBR
            else:
                dataset = DAYS
            if day not in dataset:
                days = list(dataset)
                days.sort(key=lambda e: levenshtein(day, e))
                return days[0] + day_extraction.group(2)
1189933
public static int weekCount(Date start, Date end) {
		final Calendar startCalendar = Calendar.getInstance();
		startCalendar.setTime(start);
		final Calendar endCalendar = Calendar.getInstance();
		endCalendar.setTime(end);

		final int startWeekofYear = startCalendar.get(Calendar.WEEK_OF_YEAR);
		final int endWeekofYear = endCalendar.get(Calendar.WEEK_OF_YEAR);

		int count = endWeekofYear - startWeekofYear + 1;

		if (Calendar.SUNDAY != startCalendar.get(Calendar.DAY_OF_WEEK)) {
			count--;
		}

		return count;
	}