Subtracts a number of months from the current value
190918
def subtract_months(self, months: int) -> datetime:
        
        self.value = self.value - relativedelta(months=months)
        return self.value
1321548
def size_in_months(self):
        
        if (self[0] == MONTH):
            return self[2]
        if(self[0] == YEAR):
            return self[2] * 12
        raise ValueError("Cannot calculate number of months in {0}".format(self[0]))
821135
def months_per_hour(self):
        """"""
        month_hour = []
        hour_range = xrange(self.st_hour, self.end_hour + 1)
        for month in self.months_int:
            month_hour.extend([(month, hr) for hr in hour_range])
        return month_hour
1067604
def _to_desired_dates(self, arr):
        """"""
        times = utils.times.extract_months(
            arr[internal_names.TIME_STR], self.months
        )
        return arr.sel(time=times)
140467
private long monthRange() {
        ValueRange startRange = chrono.range(MONTH_OF_YEAR);
        if (startRange.isFixed() && startRange.isIntValue()) {
            return startRange.getMaximum() - startRange.getMinimum() + 1;
        }
        return -1;
    }
877030
function getMonthDays(year, month) {
  let NUM = 30;
  if ([1, 3, 5, 7, 8, 10, 12].indexOf(month) !== -1) {
    NUM = 31;
  }
  if (month === 2) {
    NUM = isLeapYear(year) ? 29 : 28;
  }
  return NUM;
}
475215
def replace_u_end_month(month):
    """"""
    month = month.lstrip('-')
    if month == 'uu' or month == '1u':
        return '12'
    if month == 'u0':
        return '10'
    if month == '0u':
        return '09'
    if month[1] in ['1', '2']:
        # 'u1' or 'u2'
        return month.replace('u', '1')
    # Otherwise it should match r'u[3-9]'.
    return month.replace('u', '0')
935134
public static int getMonthFromDate(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal.get(Calendar.MONTH) + 1;
	}
538707
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
		if (isLeapYear && month == 2) {
			return value == 29;
		} else {
			return value == LAST_DAYS[month - 1];
		}
	}
1229120
def during(self, year, month):
		""""""
		return self.filter(created__year=year, created__month=month)
209399
def move_datetime_month(dt, direction, num_shifts):
    
    delta = relativedelta(months=+num_shifts)
    return _move_datetime(dt, direction, delta)
1295727
def Subtract(self, other):
        """"""
        for val, freq in other.Items():
            self.Incr(val, -freq)
1278574
public function subtractMonths($months)
    {
        $months = (int) $months;
        $months = -$months;
        return $this->addMonths($months);
    }
1208163
def monthly(date=datetime.date.today()):
    
    return datetime.date(date.year, date.month, 1)
525069
function check_bymonth(rules, dt) {
    if(!rules || !rules.length) return true;
    return rules.indexOf(m(dt)) !== -1;
}
1186226
def end_of_month(self) -> datetime:
        
        # Increase month by 1,
        result = self.value + relativedelta(months=1)
        # take the 1st day of the (next) month,
        result = result.replace(day=1)
        # subtract one day
        result = result - relativedelta(days=1)
        self.value = result
        return self.value
1235231
function icaltime_subtract_abs(aDate) {
      var unixTime = this.toUnixTime();
      var other = aDate.toUnixTime();
      return ICAL.Duration.fromSeconds(unixTime - other);
    }