Returns the number of weekends that this interval covers. Includes
        partial weekends.
962923
def n_weekends(self) -> int:
        
        startdate = self.start.date()
        enddate = self.end.date()
        ndays = (enddate - startdate).days + 1
        in_weekend = False
        n_weekends = 0
        for i in range(ndays):
            date = startdate + datetime.timedelta(days=i)
            if not in_weekend and is_weekend(date):
                in_weekend = True
                n_weekends += 1
            elif in_weekend and not is_weekend(date):
                in_weekend = False
        return n_weekends
1321794
private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates)
   {
      int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH);
      calendar.set(Calendar.DAY_OF_MONTH, 1);
      int requiredDayNumber = NumberHelper.getInt(m_dayNumber);
      if (requiredDayNumber < currentDayNumber)
      {
         calendar.add(Calendar.MONTH, 1);
      }

      while (moreDates(calendar, dates))
      {
         int useDayNumber = requiredDayNumber;
         int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
         if (useDayNumber > maxDayNumber)
         {
            useDayNumber = maxDayNumber;
         }
         calendar.set(Calendar.DAY_OF_MONTH, useDayNumber);
         dates.add(calendar.getTime());
         calendar.set(Calendar.DAY_OF_MONTH, 1);
         calendar.add(Calendar.MONTH, frequency);
      }
   }
56387
function daysOfWeek() {
    var result = [];
    for (var weekday = 0; weekday < 7; weekday++) {
        result.push(moment_1.utc().weekday(weekday).format("dd"));
    }
    return result;
}
520770
def previous_weekday(date):
    '''
    
    '''
    weekday = date.weekday()
    if weekday == 0:
        n_days = 3
    elif weekday == 6:
        n_days = 2
    else:
        n_days = 1
    return date - datetime.timedelta(days=n_days)
35306
private static int getWeekIndex(final Calendar cal) {
        final int val = cal.get(Calendar.DAY_OF_WEEK);
        switch(val) {
            case Calendar.SUNDAY:
                return 0;
            case Calendar.MONDAY:
                return 1;
            case Calendar.TUESDAY:
                return 2;
            case Calendar.WEDNESDAY:
                return 3;
            case Calendar.THURSDAY:
                return 4;
            case Calendar.FRIDAY:
                return 5;
            case Calendar.SATURDAY:
                return 6;
        }

        return 0;
    }
1228987
def weekend_boxing_day(start_date=None, end_date=None, observance=None):
    
    return Holiday(
        "Weekend Boxing Day",
        month=12,
        day=28,
        days_of_week=(MONDAY, TUESDAY),
        start_date=start_date,
        end_date=end_date,
        observance=observance,
    )
672755
public boolean areAllDaysExcluded ()
  {
    for (int i = 1; i <= MAX_DAYS_IN_MONTH; i++)
    {
      if (isDayExcluded (i) == false)
      {
        return false;
      }
    }

    return true;
  }
774417
def number_of_days_per_week
        ws = Date::DAYS_INTO_WEEK[@options[:week_start]]
        we = Date::DAYS_INTO_WEEK[@options[:week_end]]
        we += 7 if we <= ws
        we - ws + 1
      end
380861
public static function totalSeconds(DateInterval $interval)
    {
        $sYears = 31536000 * $interval->y;
        $sMonths = 30 * 24 * 3600 * $interval->m;
        $sDays = 24 * 3600 * $interval->d;
        $sHours = 3600 * $interval->h;
        $sMinutes = 60 * $interval->i;
        $sSeconds = $interval->s;

        $total = $sYears + $sMonths + $sDays + $sHours + $sMinutes + $sSeconds;

        return ($interval->invert === 1) ? $total * -1 : $total;
    }
634415
def prev_weekday(weekday):
    """"""
    ix = WEEKDAYS.index(weekday)
    if ix == 0:
        return WEEKDAYS[len(WEEKDAYS)-1]
    return WEEKDAYS[ix-1]
1108365
def next_workday(dt):
    
    dt += timedelta(days=1)
    while dt.weekday() > 4:
        # Mon-Fri are 0-4
        dt += timedelta(days=1)
    return dt
7810
def count(self, until=None):
        

        until = rationalize_until(until)
        return self.connection.zcount(self.scheduled_jobs_key, 0, until)
1137882
function(weekBeginDate) {
        var overlaps = false;
        var nextWeek = this.add(weekBeginDate, this.DAY, 6);
        if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
            overlaps = true;
        }
        return overlaps;
    }
892057
public Weekday getDayOfWeek() {

        long utcDays = getCalendarSystem(this.variant).transform(this);
        return Weekday.valueOf(MathUtils.floorModulo(utcDays + 5, 7) + 1);

    }
781231
def previous_week_day(base_date, weekday):
    
    day = base_date - timedelta(days=1)
    while day.weekday() != weekday:
        day = day - timedelta(days=1)
    return day
1373638
public long toMillis() {
		long totalSeconds = 0;

		if (weeks != null) {
			totalSeconds += 60L * 60 * 24 * 7 * weeks;
		}
		if (days != null) {
			totalSeconds += 60L * 60 * 24 * days;
		}
		if (hours != null) {
			totalSeconds += 60L * 60 * hours;
		}
		if (minutes != null) {
			totalSeconds += 60L * minutes;
		}
		if (seconds != null) {
			totalSeconds += seconds;
		}
		if (prior) {
			totalSeconds *= -1;
		}

		return totalSeconds * 1000;
	}
858464
def get_freq(self):
        
        if not self.is_monotonic or not self.index._is_unique:
            return None

        delta = self.deltas[0]
        if _is_multiple(delta, _ONE_DAY):
            return self._infer_daily_rule()

        # Business hourly, maybe. 17: one day / 65: one weekend
        if self.hour_deltas in ([1, 17], [1, 65], [1, 17, 65]):
            return 'BH'
        # Possibly intraday frequency.  Here we use the
        # original .asi8 values as the modified values
        # will not work around DST transitions.  See #8772
        elif not self.is_unique_asi8:
            return None

        delta = self.deltas_asi8[0]
        if _is_multiple(delta, _ONE_HOUR):
            # Hours
            return _maybe_add_count('H', delta / _ONE_HOUR)
        elif _is_multiple(delta, _ONE_MINUTE):
            # Minutes
            return _maybe_add_count('T', delta / _ONE_MINUTE)
        elif _is_multiple(delta, _ONE_SECOND):
            # Seconds
            return _maybe_add_count('S', delta / _ONE_SECOND)
        elif _is_multiple(delta, _ONE_MILLI):
            # Milliseconds
            return _maybe_add_count('L', delta / _ONE_MILLI)
        elif _is_multiple(delta, _ONE_MICRO):
            # Microseconds
            return _maybe_add_count('U', delta / _ONE_MICRO)
        else:
            # Nanoseconds
            return _maybe_add_count('N', delta)