Returns canonical URL with instance start time added as query element

@param int $start_timestamp Start time of the instance
@param int $calendar_guid   GUID of the calendar in context
@return string
429269
public function getURL($start_timestamp = 0, $calendar_guid = 0) {
		if (!$start_timestamp) {
			$start_timestamp = $this->getNextOccurrence();
		}
		$url = parent::getURL();
		return elgg_http_add_url_query_elements($url, array_filter(array(
			'ts' => $start_timestamp,
			'calendar' => $calendar_guid,
		)));
	}
44050
public function getStartTime() {
        if (!isset($this->startTime)) {
            $this->startTime = (string)$this->getData(OntologyDeliveryExecution::PROPERTY_TIME_START);
        }
        return $this->startTime;
    }
434881
public function toIcal($starttime = null, $endtime = null, $filename = 'calendar.ics') {

		if (is_null($starttime)) {
			$starttime = time();
		}
		if (is_null($endtime)) {
			$endtime = strtotime('+1 year', $starttime);
		}

		$instances = $this->getAllEventInstances($starttime, $endtime, true, 'ical');

		$config = array(
			'unique_id' => $this->guid,
			// setting these explicitly until icalcreator bug #14 is solved
			'allowEmpty' => true,
			'nl' => "\r\n",
			'format' => 'iCal',
			'delimiter' => DIRECTORY_SEPARATOR,
			'filename' => $filename, // this is last until #14 is solved
		);

		$v = new vcalendar($config);
		$v->setProperty('method', 'PUBLISH');
		$v->setProperty("X-WR-CALNAME", implode(' - ', array(elgg_get_config('sitename'), $this->getDisplayName())));
		$v->setProperty("X-WR-CALDESC", strip_tags($this->description));
		$v->setProperty("X-WR-TIMEZONE", Util::UTC);
		foreach ($instances as $instance) {

			$e = & $v->newComponent('vevent');

			$organizer = elgg_extract('organizer', $instance, array());
			unset($instance['organizer']);

			$reminders = elgg_extract('reminders', $instance, array());
			unset($instance['reminders']);

			foreach ($instance as $property => $value) {
				$e->setProperty($property, $value);
			}

			if (!empty($organizer)) {
				if (is_email_address($organizer)) {
					$e->setProperty('organizer', $organizer);
				} else {
					$e->setProperty('organizer', elgg_get_site_entity()->email, array(
						'CN' => $organizer,
					));
				}
			}

			if (!empty($reminders)) {
				foreach ($reminders as $reminder) {
					$a = & $e->newComponent('valarm');
					$a->setProperty('action', 'DISPLAY');
					$a->setProperty('trigger', "-PT{$reminder}S");
				}
			}
		}

		$v->returnCalendar();
	}
1105707
public function scanStarted(Event $event, $startTime, $fullBaseUrl)
    {
        if ($this->args->getOption('verbose')) {
            $this->io->hr();
        }

        $startTime = (new Time($startTime))->i18nFormat('yyyy-MM-dd HH:mm:ss');
        $this->io->info(__d('link-scanner', 'Scan started for {0} at {1}', $fullBaseUrl, $startTime));

        if (!$this->args->getOption('verbose')) {
            return true;
        }

        $this->io->hr();

        $cache = Cache::getConfig('LinkScanner');
        if (!$this->args->getOption('no-cache') && Cache::enabled() && !empty($cache['duration'])) {
            $this->io->success(__d('link-scanner', 'The cache is enabled and its duration is `{0}`', $cache['duration']));
        } else {
            $this->io->info(__d('link-scanner', 'The cache is disabled'));
        }

        if ($this->args->getOption('force')) {
            $this->io->info(__d('link-scanner', 'Force mode is enabled'));
        } else {
            $this->io->info(__d('link-scanner', 'Force mode is not enabled'));
        }

        if ($event->getSubject()->getConfig('externalLinks')) {
            $this->io->info(__d('link-scanner', 'Scanning of external links is enabled'));
        } else {
            $this->io->info(__d('link-scanner', 'Scanning of external links is not enabled'));
        }

        if ($event->getSubject()->getConfig('followRedirects')) {
            $this->io->info(__d('link-scanner', 'Redirects will be followed'));
        } else {
            $this->io->info(__d('link-scanner', 'Redirects will not be followed'));
        }

        $maxDepth = $event->getSubject()->getConfig('maxDepth');
        if (is_positive($maxDepth)) {
            $this->io->info(__d('link-scanner', 'Maximum depth of the scan: {0}', $maxDepth));
        }

        $timeout = $event->getSubject()->Client->getConfig('timeout');
        if (is_positive($timeout)) {
            $this->io->info(__d('link-scanner', 'Timeout in seconds for GET requests: {0}', $timeout));
        }

        $this->io->hr();

        return true;
    }
705698
public function getCalendarsForRoute($externalCoverageId, $externalRouteId, \DateTime $startDate, \DateTime $endDate)
    {
        $calendarsData = $this->navitia->getRouteCalendars($externalCoverageId, $externalRouteId, $startDate, $endDate);
        $calendarsSorted = array();
        if (isset($calendarsData->calendars) && !empty($calendarsData->calendars)) {
            foreach ($calendarsData->calendars as $calendar) {
                //make it easier for template
                $calendarsSorted[$calendar->id] = $calendar;
            }
        }

        return $calendarsSorted;
    }
324378
public function getHubWindowAtThisTime(\DateTime $startTime, $delivery_type)
    {
        $windows = $this->getHubWindowsIndexedByStartTimeAndDeliveryType();

        if (!empty($windows[$startTime->format(\DateTime::ATOM)][$delivery_type]))
        {
            return $windows[$startTime->format(\DateTime::ATOM)][$delivery_type];
        }

        return false;
    }
173507
private static function buildFindByDayIntervalUrl(PagSeguroConnectionData $connectionData, $interval)
    {
        $url = $connectionData->getWebserviceUrl() . $connectionData->getResource('findUrl') . 'notifications';
        return "{$url}?" . $connectionData->getCredentialsUrlQuery() . "&interval=" . $interval;
    }
1356456
public static function createFromStartDuration(CalendarDate $start, Duration $duration, $recurrence = null)
    {
        return static::create($start, null, $duration, $recurrence);
    }
574583
public function getLeads($startDate, $endDate, array $params = array())
    {
        $isValidStartDate = $this->utils->isSystemDatetime($startDate);
        $isValidEndDate = $this->utils->isSystemDatetime($endDate);
        if (!$isValidEndDate || !$isValidStartDate) {
            throw new InvalidArgumentException('Invalid params: Only system date has available YYYY-MM-DDD HH:II:SS');
        }

        if ($startDate > $endDate) {
            throw new InvalidArgumentException('Invalid params: start_date > end_date');
        }

        $isOutOfLimit = $this->utils->isOutOfLimit($startDate, $endDate, LeadAcademic::LIMIT_PERIOD);
        if ($isOutOfLimit) {
            throw new InvalidArgumentException('Invalid params: Period is too large. Available only ' . LeadAcademic::LIMIT_PERIOD);
        }

        $params['date_lbound'] = $startDate;
        $params['date_ubound'] = $endDate;

        $this->normalizeParams($params);
        $response = $this->execute('/', $params);
        $data = $this->normalize($response);
        return $data['leads'];
    }
153312
public function logProcessStartedAt(ProcessId $processId, \DateTimeImmutable $startedAt)
    {
        $data = [
            'started_at' => $startedAt->format(\DateTime::ISO8601),
        ];

        $entry = $this->loadProcessEntryIfExists($processId);

        if (is_null($entry)) {
            $data['status'] = self::STATUS_RUNNING;

            $this->insertNewEntry($processId, $data);
        } else {
            $this->updateEntry($processId, $data);
        }
    }
466500
protected function getStartDate()
    {
        $StartDate = false;
        $objStartDate = \Database::getInstance()->prepare("SELECT
                                                           MIN(`tstamp`) AS YMD
                                                           FROM `tl_dlstatdets`
                                                           WHERE 1")
                                                ->execute();
        if ($objStartDate->YMD !== null)
        {
            $StartDate = \Date::parse($GLOBALS['TL_CONFIG']['dateFormat'], $objStartDate->YMD);

        }

        return $StartDate;
    }
133787
public com.google.api.ads.admanager.axis.v201811.DateTime getStartTime() {
        return startTime;
    }
365598
public function getOneTimeEvents($starttime = null, $endtime = null) {

		if (is_null($starttime)) {
			$starttime = time();
		}
		if (is_null($endtime)) {
			$endtime = strtotime('+1 year', $starttime);
		}

		$starttime = sanitize_int($starttime);
		$endtime = sanitize_int($endtime);
		$relationship_name = sanitize_string(self::EVENT_CALENDAR_RELATIONSHIP);

		$dbprefix = elgg_get_config('dbprefix');

		// for performance we'll denormalize metastrings first
		$mdr_name = elgg_get_metastring_id('repeat');
		$mdr_val = elgg_get_metastring_id(0);
		$mds_name = elgg_get_metastring_id('start_timestamp');
		$mde_name = elgg_get_metastring_id('end_timestamp');
		$options = array(
			'type' => 'object',
			'subtype' => Event::SUBTYPE,
			'joins' => array(
				"JOIN {$dbprefix}entity_relationships er ON er.guid_one = e.guid", // calendar relationship
				"JOIN {$dbprefix}metadata mdr ON mdr.entity_guid = e.guid", // repeating metadata
				"JOIN {$dbprefix}metadata mds ON mds.entity_guid = e.guid", // start time metadata
				"JOIN {$dbprefix}metastrings mss ON mss.id = mds.value_id", // start time metastring
				"JOIN {$dbprefix}metadata mde ON mde.entity_guid = e.guid", // end time metadata
				"JOIN {$dbprefix}metastrings mse ON mse.id = mde.value_id" // end time metastring
			),
			'wheres' => array(
				"er.guid_two = {$this->guid} AND er.relationship = '{$relationship_name}'",
				"mdr.name_id = {$mdr_name} AND mdr.value_id = {$mdr_val}",
				"mds.name_id = {$mds_name}",
				"mde.name_id = {$mde_name}",
				"((CAST(mss.string AS SIGNED) BETWEEN {$starttime} AND {$endtime})
					OR (CAST(mse.string AS SIGNED) BETWEEN {$starttime} AND {$endtime}))"
			),
			'limit' => false
		);

		return new ElggBatch('elgg_get_entities', $options);
	}
39344
public function addRescheduleItemToSession($startDay = 1, $endDay = 7, \DateTime $startTime = null, $reason = null)
    {
        $result = false;
        if (isset($this->getEvent()['leadEventLog'])) {
            // To randomly disperse API requests we must get all openings within the date range first.
            $all = 'api' === $this->contactClient->getType();

            // Get all openings if API, otherwise just get the first available.
            $openings = $this->payloadModel->getScheduleModel()->findOpening($startDay, $endDay, 1, $all, $startTime);
            if ($openings) {
                // Select an opening.
                if ($all) {
                    $opening = $openings[rand(0, count($openings) - 1)];
                } else {
                    $opening = reset($openings);
                }
                /**
                 * @var \DateTime
                 * @var $end      \DateTime
                 */
                list($start, $end) = $opening;

                // Randomly disperse within this range of time if needed.
                if ($all) {
                    // How many seconds are there in this range, minus a minute for margin of error at the end of day?
                    $rangeSeconds = max(0, ($end->format('U') - $start->format('U') - 60));
                    $randSeconds  = rand(0, $rangeSeconds);
                    $start->modify('+'.$randSeconds.' seconds');
                }

                // Add leadEventLog id instance to global session array for later processing in reschedule() dispatch.
                $eventLogId          = $this->getEvent()['leadEventLog']->getId();
                $events              = $this->getSession()->get('contact.client.reschedule.event', []);
                $events[$eventLogId] = [
                    'triggerDate' => $start,
                    'reason'      => $reason,
                ];
                $this->getSession()->set('contact.client.reschedule.event', $events);
                $result = true;
            }
        }

        return $result;
    }
1330306
public function findCalendarDatas(Blog $blog, $startDate, $endDate, $executeQuery = true)
    {
        $startDateTime = new \DateTime($startDate);
        $currentTimestamp = time();
        $endDateTime = new \DateTime($endDate);

        if ($currentTimestamp < $endDate) {
            $endDateTime->setTimestamp($currentTimestamp);
        }

        $query = $this->createQueryBuilder('post')
            ->select(['post'])
            ->andWhere('post.blog = :blogId')
            ->andWhere('post.status = :postStatus')
            ->andWhere('post.publicationDate IS NOT NULL')
            ->andWhere('post.publicationDate BETWEEN :startDate AND :endDate')
            ->setParameter('blogId', $blog->getId())
            ->setParameter('postStatus', Statusable::STATUS_PUBLISHED)
            ->setParameter('startDate', $startDateTime)
            ->setParameter('endDate', $endDateTime)
            ->getQuery()
        ;

        return $executeQuery ? $query->getResult() : $query;
    }
311715
public function getStartTime($precision = 0, $floatingPrecision = 3, $showUnit = true)
    {
        return $this->getFormattedTime($this->startTime, $precision, $floatingPrecision, $showUnit);
    }
672793
public static function requestStartTime($test = false) {
        if(defined('TIME_START') && $test === false) $startTime = TIME_START;
        elseif(isset($GLOBALS['TIME_START'])) $startTime = $GLOBALS['TIME_START'];
        else $startTime = env('REQUEST_TIME');

        return $startTime;
    }