@param DateTime $beginDate
@param DateTime $endDate

@return int
344317
public static function getSecondsCount($beginDate, $endDate)
    {
        // Get minutes count
        $minutes = static::getMinutesCount($beginDate, $endDate);

        // Get seconds
        $diff = $endDate->diff($beginDate);
        $seconds = $diff->s;

        // Return all seconds
        return $seconds + $minutes * 60;
    }
937315
public function getEventsQueryBuilder(\DateTime $begin, \DateTime $end, array $options = array())
    {
        $begin = sprintf("'%s'", $begin->format('Y-m-d H:i:s'));
        $end   = sprintf("'%s'", $end->format('Y-m-d H:i:s'));
        $qb    = $this->createQueryBuilderForGetEvent($options);

        return $qb
            ->andWhere(
                $qb->expr()->orX(
                // Period in event
                    $qb->expr()->andX(
                        $qb->expr()->lte($this->getBeginFieldName(), $begin),
                        $qb->expr()->gte($this->getEndFieldName(), $end)
                    ),
                    // Event in period
                    $qb->expr()->andX(
                        $qb->expr()->gte($this->getBeginFieldName(), $begin),
                        $qb->expr()->lt($this->getEndFieldName(), $end)
                    ),
                    // Event begins during period
                    $qb->expr()->andX(
                        $qb->expr()->lt($this->getBeginFieldName(), $end),
                        $qb->expr()->gte($this->getBeginFieldName(), $begin)
                    ),
                    // Event ends during period
                    $qb->expr()->andX(
                        $qb->expr()->gte($this->getEndFieldName(), $begin),
                        $qb->expr()->lt($this->getEndFieldName(), $end)
                    )
                )
            )
            ;
    }
481390
public static function getRequestTime(float $begin, float $end, string $format): string
    {
        $time = $begin;

        if (strpos($format, 'begin:') === 0) {
            $format = substr($format, 6);
        } elseif (strpos($format, 'end:') === 0) {
            $time = $end;
            $format = substr($format, 4);
        }

        switch ($format) {
            case 'sec':
                return sprintf('[%s]', round($time));
            case 'msec':
                return sprintf('[%s]', round($time * 1E3));
            case 'usec':
                return sprintf('[%s]', round($time * 1E6));
            default:
                return sprintf('[%s]', strftime($format, (int) $time));
        }
    }
175675
private function applyDateFilter($objectsIterator, $startDate, $endDate)
    {
        // If either a start or end date was provided, filter out dates that
        // don't match the date range.
        if ($startDate || $endDate) {
            $fn = function ($object) use ($startDate, $endDate) {
                if (!preg_match('/[0-9]{8}T[0-9]{4}Z/', $object['Key'], $m)) {
                    return false;
                }
                $date = strtotime($m[0]);

                return (!$startDate || $date >= $startDate)
                    && (!$endDate || $date <= $endDate);
            };
            $objectsIterator = new \CallbackFilterIterator($objectsIterator, $fn);
        }

        return $objectsIterator;
    }
439790
public static long getDaysBetweenIgnoreTime(Date startDate, Date endDate) {
        startDate = getRoundedDay(startDate);
        endDate = getNextDay(endDate);
        return getBetweenDate(startDate, endDate);
    }
342652
public function getTimeEntries($startdate = null, $enddate = null)
    {
        if (empty($startdate)) {
            $startdate = date('Y-m-d', time() - 86400);
        }
        if (empty($enddate)) {
            $enddate = $startdate;
        }
        $this->uri = 'https://toggl.com/reports/api/v2/details?user_agent=' . $this->user_agent . '&since=' . $startdate . '&until=' . $enddate . '&workspace_id=' . $this->workspace_id;

        $data = null;
        
        $response = $this->processRequest($data, self::GET);
        $this->_handleError($data, $response);
        $toggl_entries = $this->processTogglResponse($response);
        $timeEntries = [];
        foreach ($toggl_entries as $entry) {
            $te = new TimeEntry(
                $this,
                $entry->id,
                $entry->client,
                $entry->project,
                $entry->description
            );
            $te->setEntryDate(date('Y-m-d', strtotime($entry->start)));
            $te->setDurationTime($entry->dur);
            $te->setTask($entry->task);
            $te->setDescription($entry->description);
            $te->processTags($entry->tags);
            $te->setBillable($entry->is_billable);
            $timeEntries[] = $te;
        }
        return $timeEntries;
    }
81178
public function fire(Carbon $startDate, Carbon $endDate)
    {
        $this->start = $startDate;
        $this->end   = $endDate;

        return $this->getData();
    }
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;
}
658724
public function performQuery($startDate, $endDate, $metrics, $others = [])
    {
        $startDate = $startDate->format('Y-m-d');
        $endDate = $endDate->format('Y-m-d');
        $cacheName = $this->determineCacheName([$startDate, $endDate, $metrics, $others]);

        if ($this->useCache() and Cache::has($cacheName)) {
            $answer = Cache::get($cacheName);
        } else {
            $answer = $this->client->query($this->siteId, $startDate, $endDate, $metrics, $others);
            if ($this->useCache()) {
                Cache::put($cacheName, $answer, $this->cacheLifeTimeInMinutes);
            }
        }

        return $answer;
    }
1307403
protected function areWeInRange($startDate, $endDate){
        return (empty($startDate) || date_create() >= $startDate)
        && (empty($endDate) || date_create() <= $endDate);
    }
1128351
public boolean insideRange(long startDate, long endDate) {
	Calendar c1 = Calendar.getInstance();
	Calendar c2 = Calendar.getInstance();
	c1.setTimeInMillis(startDate);
	c2.setTimeInMillis(endDate);
	return isInRange(c1, c2);
    }
1090218
public function monthArray($begin, $end, $year = '')
    {
        if (empty($year)) {
            $year = date('Y');
        }
        $dateArray = array();
        for ($i = $begin; $i <= $end; ++$i) {
            $dateArray[] = $i;
        }
        return $dateArray;
    }
1004039
public function dateArray($begin, $end, $format = 'Y-m-d')
    {
        $begin = new \DateTime($begin);
        $end = new \DateTime($end);
        $end = $end->modify('+1 day');

        $interval = new \DateInterval('P1D');
        $daterange = new \DatePeriod($begin, $interval, $end);

        $dateArray = array();
        foreach ($daterange as $date) {
            $dateArray[] = $date->format($format);
        }

        return $dateArray;
    }
815774
public function whereBetweenTime($field, $startTime, $endTime = null)
    {
        if (is_null($endTime)) {
            $time    = is_string($startTime) ? strtotime($startTime) : $startTime;
            $endTime = strtotime('+1 day', $time);
        }

        $this->where($field, 'between time', [$startTime, $endTime]);

        return $this;
    }
161544
public static LinkedHashSet<String> yearAndQuarter(long startDate, long endDate) {
		LinkedHashSet<String> quarters = new LinkedHashSet<>();
		final Calendar cal = calendar(startDate);
		while (startDate <= endDate) {
			// 如果开始时间超出结束时间，让结束时间为开始时间，处理完后结束循环
			quarters.add(yearAndQuarter(cal));

			cal.add(Calendar.MONTH, 3);
			startDate = cal.getTimeInMillis();
		}

		return quarters;
	}
566366
public static long betweenMonth(Date beginDate, Date endDate, boolean isReset) {
		return new DateBetween(beginDate, endDate).betweenMonth(isReset);
	}
288284
public function getGamesByRangeDate($startDate = '', $endDate = '', $onlyActive = false)
    {
        $em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');

        $startDateTime = \DateTime::createFromFormat('d/m/Y', $startDate);
        $endDateTime = \DateTime::createFromFormat('d/m/Y', $endDate);

        if ($startDate != '' && $endDate != '') {
            $dateRange = "(g.publicationDate >='" . $startDateTime->format('Y-m-d') . " 0:0:0' AND g.publicationDate <= '" . $endDateTime->format('Y-m-d') . " 0:0:0')";
        } elseif ($startDate == '' && $endDate != '') {
            $dateRange = "g.publicationDate <= '" . $endDateTime->format('Y-m-d') . " 0:0:0'";
        } elseif ($startDate != '' && $endDate == '') {
            $dateRange = "g.publicationDate >='" . $startDateTime->format('Y-m-d') . " 0:0:0'";
        } else {
            $dateRange = "g.publicationDate IS NOT NULL";
        }

        $active = '';
        if ($onlyActive) {
            $active = ' AND g.active=1';
        }

        $query = $em->createQuery('
            SELECT COUNT(g.id) FROM PlaygroundGame\Entity\Game g
			WHERE ' . $dateRange . $active);
        $count = $query->getSingleScalarResult();
        return $count;
    }