Gibt eine Anzahl von Datumswerten zurueck.

@param  string $startDate - Startzeitpunkt (Format: yyyy-mm-dd)
@param  int    $days      - Anzahl der zurueckzugebenden Werte

@return array
489322
public static function getDateRange($startDate, $days) {
        if (!is_string($startDate))                      throw new IllegalTypeException('Illegal type of parameter $startDate: '.gettype($startDate));
        if (Validator::isDateTime($startDate) === false) throw new InvalidArgumentException('Invalid argument $startDate: "'.$startDate.'"');
        if (!is_int($days))                              throw new IllegalTypeException('Illegal type of parameter $days: '.gettype($days));
        if ($days < 0)                                   throw new InvalidArgumentException('Invalid argument $days: '.$days);

        $range = array();
        $date  = new DateTime($startDate);

        for ($i=0; $i < $days; ++$i) {
            $range[] = $date->format('Y-m-d');
            $date->modify('+1 day');
        }
        return $range;
    }
484148
public function setStartDate($startDate): void
    {
        if (is_string($startDate)) {
            $startDate = new Time($startDate);
        }

        $this->startDate = $startDate;
    }
327351
public static function formatted_dates($startObj, $endObj)
    {

        //Checking if end date is set
        $endDateIsset = true;
        if (isset($endObj->value)) {
            $endDateIsset = false;
        }

        $startTime = strtotime($startObj->value);
        $endTime = strtotime($endObj->value);

        $startMonth = date('M', $startTime);
        $startDayOfMonth = $startObj->DayOfMonth(true);
        $str = $startMonth . ' ' . $startDayOfMonth;

        if (date('Y-m-d', $startTime) == date('Y-m-d', $endTime)) {
            //one date - str. has already been written
        } else {
            //two dates

            if ($endDateIsset) {
                $endMonth = date('M', $endTime);
                $endDayOfMonth = $endObj->DayOfMonth(true);

                if ($startMonth == $endMonth) {
                    $str .= ' - ' . $endDayOfMonth;
                } else {
                    $str .= ' - ' . $endMonth . ' ' . $endDayOfMonth;
                }
            }
        }
        return $str;
    }
1097481
function(startDate, endDate) {
    var current = new Date(startDate);
    var end = new Date(endDate); 
    var dates = [];

    while(current <= end) {

        var m = current.getMonth() + 1;
        var d = current.getDate();
        var oneDate = [
            current.getFullYear(),
            m < 10 ? "0" + m : m,
            d < 10 ? "0" + d : d].join('-');

        dates.push(oneDate);
        current.setDate(current.getDate() + 1);
    }

    return dates;
}
1294687
protected function getVisitsViewsUsers($days = 30)
    {
        list($startDate, $endDate) = $this->calculateDays($days);

        $this->getVisitsViewsUsersForPeriod($startDate, $endDate);
    }
134074
public function setStartDate(Carbon $startDate)
    {
        $this->validatePeriod($startDate, null);

        $this->startDate = $startDate;

        return $this;
    }
169730
private static function expandDaysRange(array $days) : array
	{
		static $dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',];
		$expandedValues = [];

		foreach ($days as $day) {
			if (Strings::match($day, '~^\w{3}\s*-\s*\w{3}$~u')) {
				list($begin, $end) = Strings::split($day, '~\s*-\s*~');
				$started = FALSE;
				foreach ($dayNames as $dayName) {
					if ($dayName === $begin) {
						$started = TRUE;
					}
					if ($started) {
						$expandedValues[] = $dayName;
					}
					if ($dayName === $end) {
						$started = FALSE;
					}
				}
			} else {
				$expandedValues[] = $day;
			}
		}

		return array_unique($expandedValues);
	}
163814
public static function countMonthBetweenDate($startDate, $endDate)
    {
    	$d1 = strtotime($startDate);
		$d2 = strtotime($endDate);
		$min_date = min($d1, $d2);
		$max_date = max($d1, $d2);
		$i = 0;

		while (($min_date = strtotime("+1 MONTH", $min_date)) <= $max_date) {
		    $i++;
		}
		echo $i;
    }
1177845
def _ndays(self, start_date, ndays):
        
        if not getattr(self.args, 'start-date') and not self.config.get('start-date', None):
            raise Exception('start-date must be provided when ndays is used.')

        d = date(*map(int, start_date.split('-')))
        d += timedelta(days=ndays)

        return d.strftime('%Y-%m-%d')
749696
public function weeks($startDay = 'Monday')
    {
        if (!isset($this->weeks[$startDay])) {
            $this->weeks[$startDay] = array();
            $keepWeeking = true;
            $weekPoint = clone $this->firstDay();

            while ($keepWeeking) {
                $candidateWeek = new Week($weekPoint, $startDay);
                if ($candidateWeek->weekStart() <= $this->lastDay()) {
                    $candidateWeek->setContainingMonth($this);
                    $this->weeks[$startDay][] = $candidateWeek;
                    $weekPoint->modify('+1 week');
                } else {
                    $keepWeeking = false;
                }
            }
        }
        return $this->weeks[$startDay];
    }
124525
protected function processOptimalSubperiods($startDate, $endDate)
    {
        while ($startDate->isEarlier($endDate)
            || $startDate == $endDate
        ) {
            $week        = new Week($startDate);
            $startOfWeek = $week->getDateStart();
            $endOfWeek   = $week->getDateEnd();

            if ($endOfWeek->isLater($endDate)) {
                $this->fillDayPeriods($startDate, $endDate);
            } elseif ($startOfWeek == $startDate) {
                $this->addSubperiod($week);
            } else {
                $this->fillDayPeriods($startDate, $endOfWeek);
            }

            $startDate = $endOfWeek->addDay(1);
        }
    }
268729
public function setDateStart( $date )
	{
		if ( $date === $this->getDateStart() ) { return; }

		$this->_checkDateFormat($date);

		$this->_values['start'] = ( $date !== null ? (string) $date : null );
		$this->setModified();
	}
1307403
protected function areWeInRange($startDate, $endDate){
        return (empty($startDate) || date_create() >= $startDate)
        && (empty($endDate) || date_create() <= $endDate);
    }
1033008
protected function getVisitsViewsUsersForPeriod(
        DateTime $startDate,
        DateTime $endDate
    ) {
        $cacheName = md5(serialize('visits-views-users'
            .$startDate->format('Y-m-d').$endDate->format('Y-m-d')));

        $urlParams = [
            'ids'        => $this->counter_id,
            'date1'      => $startDate->format('Y-m-d'),
            'date2'      => $endDate->format('Y-m-d'),
            'metrics'    => 'ym:s:visits,ym:s:pageviews,ym:s:users',
            'dimensions' => 'ym:s:date',
            'sort'       => 'ym:s:date',
        ];

        $this->data = $this->request($urlParams, $cacheName);
    }
510223
public function getStartDate() : ?int 
    {
        if ( ! $this->hasStartDate()) {
            $this->setStartDate($this->getDefaultStartDate());
        }
        return $this->startDate;
    }
364329
public function byDays(int $days): Date
    {
        return $this->dayTo($this->originalDate->day() + $days);
    }
109731
public function getTotalDays()
    {
        $start = new \DateTime($this->getFrom());
        $end = new \DateTime($this->getTo());
        $diff = $start->diff($end);
        return $diff->format('%a');
    }