Returns the number of days of difference
19494
def days(self,local=False):
        
        delta = self.delta(local)
        return delta.days
1316230
public CalendarDays minus(CalendarDays other) {

        return CalendarDays.of(Math.subtractExact(this.days, other.days));

    }
1174423
private int getDaysToNextMatch(WeekDay weekDay) {

        for (WeekDay wd : m_weekDays) {
            if (wd.compareTo(weekDay) > 0) {
                return wd.toInt() - weekDay.toInt();
            }
        }
        return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS))
            - weekDay.toInt();
    }
1276271
public static DayOfWeek plus(final DayOfWeek self, int days) {
        int daysPerWeek = DayOfWeek.values().length;
        int val = ((self.getValue() + days - 1) % daysPerWeek) + 1;
        return DayOfWeek.of(val > 0 ? val : daysPerWeek + val);
    }
1134531
static int countInPeriod(DayOfWeek dow, DayOfWeek dow0, int nDays) {
		//two cases:
		//   (1a) dow >= dow0: count === (nDays - (dow - dow0)) / 7
		//   (1b) dow < dow0:  count === (nDays - (7 - dow0 - dow)) / 7
		if (dow.getCalendarConstant() >= dow0.getCalendarConstant()) {
			return 1 + ((nDays - (dow.getCalendarConstant() - dow0.getCalendarConstant()) - 1) / 7);
		} else {
			return 1 + ((nDays - (7 - (dow0.getCalendarConstant() - dow.getCalendarConstant())) - 1) / 7);
		}
	}
314578
def _workdaycount(self, date1, date2):
        
        assert date2 >= date1
        date1wd = date1.weekday()
        date2wd = date2.weekday()
        if not self.weekdaymap[date2wd].isworkday:
            date2 += datetime.timedelta(days=self.weekdaymap[date2wd].offsetprev)
            date2wd = self.weekdaymap[date2wd].prevworkday
        if date2 <= date1:
            return 0
        
        nw, nd = divmod((date2 - date1).days, 7)
        ndays = nw * len(self.workdays)
        if nd > 0:
            date1wd = date1.weekday()
            date2wd = date2.weekday()
            while date1wd != date2wd:
                ndays += 1
                date1wd = self.weekdaymap[date1wd].nextworkday
        return ndays
859962
def get_day_of_month(datestring):
    
    get_day = re.compile(r"\d{1,2}(st|nd|rd|th)?", re.IGNORECASE)
    day = get_day.search(datestring)
    the_day = None

    if day:
        if bool(re.search(r"[st|nd|rd|th]", day.group().lower())):
            the_day = day.group()[:-2]
        else:
            the_day = day.group()
        if int(the_day) < 10:
            the_day = add_zero(the_day)

    return str(the_day)
583279
function getWeekNumber(day) {
  var date = clone(day);
  date.setHours(0, 0, 0);
  date.setDate(date.getDate() + 4 - (date.getDay() || 7));
  return Math.ceil(((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);
}
541146
function dateDiff($d1, $d2)
    {
        $date1 = strtotime($d1);
        $date2 = strtotime($d2);
        $seconds = $date1 - $date2;
        $weeks = floor($seconds / 604800);
        $seconds -= $weeks * 604800;
        $days = floor($seconds / 86400);
        $seconds -= $days * 86400;
        $hours = floor($seconds / 3600);
        $seconds -= $hours * 3600;
        $minutes = floor($seconds / 60);
        $seconds -= $minutes * 60;
        $months = round(($date1 - $date2) / 60 / 60 / 24 / 30);
        $years = round(($date1 - $date2) / (60 * 60 * 24 * 365));

        $secs_unit = (abs($seconds) == 1) ? ' Second ' : ' Seconds ';
        $mins_unit = (abs($minutes) == 1) ? ' Minute ' : ' Minutes ';
        $hours_unit = (abs($hours) == 1) ? ' Hour ' : ' Hours ';
        $days_unit = (abs($days) == 1) ? ' Day ' : ' Days ';
        $weeks_unit = (abs($weeks) == 1) ? ' Week ' : ' Weeks ';
        $months_unit = (abs($months) == 1) ? ' Month ' : ' Months ';
        $years_unit = (abs($years) == 1) ? ' Year ' : ' Years ';

        $difference = "";

        if (!empty($years))
            $difference .= $years . $years_unit;
        if (!empty($months))
            $difference .= $months . $months_unit;
        if (!empty($weeks))
            $difference .= $weeks . $weeks_unit;
        if (!empty($days))
            $difference .= $days . $days_unit;
        if (!empty($hours))
            $difference .= $hours . $hours_unit;
        if (!empty($minutes))
            $difference .= $minutes . $mins_unit;
        if (!empty($seconds))
            $difference .= $seconds . $secs_unit;

        return $difference;
    }
1106112
def dateAt(self, x):
        
        gantt       = self.ganttWidget()
        dstart      = gantt.dateStart()
        days        = int(x / float(gantt.cellWidth()))
        
        return dstart.addDays(days)
380135
function dayOfWeek() {
        $num = func_num_args();
        if ($num == 3) {
            $args = func_get_args();
            $y = $args[0];
            $m = $args[1];
            $d = $args[2];
        }
        else {
            $y = $this->year;
            $m = $this->month;
            $d = $this->day;
        }
        $d += $m < 3 ? $y-- : $y - 2;
        return ((int)(23 * $m / 9) + $d + 4 + (int)($y / 4) - (int)($y / 100) + (int)($y / 400)) % 7;
    }
1149917
private static int isTodayOrTomorrow(Resources r, long dayMillis,
                                         long currentMillis, long localGmtOffset) {
        int startDay = Time.getJulianDay(dayMillis, localGmtOffset);
        int currentDay = Time.getJulianDay(currentMillis, localGmtOffset);

        int days = startDay - currentDay;
        if (days == 1) {
            return TOMORROW;
        } else if (days == 0) {
            return TODAY;
        } else {
            return NONE;
        }
    }
1198042
def _seconds_to_days(cls, val, **kwargs):
        '''
        
        '''
        zero_value = kwargs.get('zero_value', 0)
        if val is not None:
            if val == zero_value:
                return 0
            return val / 86400
        else:
            return 'Not Defined'
458053
def _days(cls, start, end):
        
        days = []
        # datetime
        start_day, end_day = dt.strptime(start, cls.DATE_FORMAT), dt.strptime(end, cls.DATE_FORMAT)
        delta = end_day - start_day

        for day in range(delta.days+1):
            days.append(start_day + timedelta(days=day))
        return days
141066
public function subtractDays($days)
    {
        $days = (int) $days;
        $days = -$days;
        return $this->addDays($days);
    }
355115
def iterdays(self, d1, d2):
        
        curr = datetime.datetime.combine(d1, datetime.time())
        end = datetime.datetime.combine(d2, datetime.time())
        if d1.date() == d2.date():
            yield curr
            return
        while curr < end:
            yield curr
            curr = curr + datetime.timedelta(days=1)
884391
function countDays (koyomi, firstDay, length) {
  var days = 0;
  var d = firstDay;
  while(length--){
    if (koyomi.isOpen(d)) {
      days++;
    }
    d.setTime(d.getTime() + A_DAY);
  }
  return days;
}