當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Date::toString方法代碼示例

本文整理匯總了PHP中Piwik\Date::toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Date::toString方法的具體用法?PHP Date::toString怎麽用?PHP Date::toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Date的用法示例。


在下文中一共展示了Date::toString方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTable

 protected static function getTable(Date $date, $type)
 {
     $tableNamePrefix = "archive_" . $type;
     $tableName = $tableNamePrefix . "_" . $date->toString('Y_m');
     $tableName = Common::prefixTable($tableName);
     self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix);
     return $tableName;
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:8,代碼來源:ArchiveTableCreator.php

示例2: setDateMonthAndYear

 private function setDateMonthAndYear($dateString, Date $archiveDate)
 {
     return $archiveDate->toString('Y-m') . '-' . Date::factory($dateString)->toString('d');
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:4,代碼來源:RawArchiveDataWithTempAndInvalidated.php

示例3: setMaxDateView

 /**
  * Sets the last date available in the period selector's calendar. Usually this is just the "today" date
  * for a site (which varies based on the timezone of a site).
  *
  * @param Date $maxDate The max date.
  * @param View $view The view that contains the period selector.
  * @api
  */
 protected function setMaxDateView(Date $maxDate, $view)
 {
     $view->maxDateYear = $maxDate->toString('Y');
     $view->maxDateMonth = $maxDate->toString('m');
     $view->maxDateDay = $maxDate->toString('d');
 }
開發者ID:brienomatty,項目名稱:elmsln,代碼行數:14,代碼來源:Controller.php

示例4: shouldPurgeOutdatedArchives

 /**
  * Given a monthly archive table, will delete all reports that are now outdated,
  * or reports that ended with an error
  *
  * @param \Piwik\Date $date
  * @return int|bool  False, or timestamp indicating which archives to delete
  */
 public static function shouldPurgeOutdatedArchives(Date $date)
 {
     if (self::$purgeOutdatedArchivesIsDisabled) {
         return false;
     }
     $key = self::FLAG_TABLE_PURGED . "blob_" . $date->toString('Y_m');
     $timestamp = Option::get($key);
     // we shall purge temporary archives after their timeout is finished, plus an extra 6 hours
     // in case archiving is disabled or run once a day, we give it this extra time to run
     // and re-process more recent records...
     $temporaryArchivingTimeout = self::getTodayArchiveTimeToLive();
     $hoursBetweenPurge = 6;
     $purgeEveryNSeconds = max($temporaryArchivingTimeout, $hoursBetweenPurge * 3600);
     // we only delete archives if we are able to process them, otherwise, the browser might process reports
     // when &segment= is specified (or custom date range) and would below, delete temporary archives that the
     // browser is not able to process until next cron run (which could be more than 1 hour away)
     if (self::isRequestAuthorizedToArchive() && (!$timestamp || $timestamp < time() - $purgeEveryNSeconds)) {
         Option::set($key, time());
         if (self::isBrowserTriggerEnabled()) {
             // If Browser Archiving is enabled, it is likely there are many more temporary archives
             // We delete more often which is safe, since reports are re-processed on demand
             $purgeArchivesOlderThan = Date::factory(time() - 2 * $temporaryArchivingTimeout)->getDateTime();
         } else {
             // If cron core:archive command is building the reports, we should keep all temporary reports from today
             $purgeArchivesOlderThan = Date::factory('today')->getDateTime();
         }
         return $purgeArchivesOlderThan;
     }
     Log::info("Purging temporary archives: skipped.");
     return false;
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:38,代碼來源:Rules.php

示例5: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Date $date ($this->date from controller)
  * @param null|string $graphType
  * @throws Exception
  */
 public function __construct($idSite, $date, $graphType = 'graphEvolution')
 {
     $this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = DataTablePostProcessor::getLabelFromRequest($_GET);
     if (!is_array($this->label)) {
         throw new Exception("Expected label to be an array, got instead: " . $this->label);
     }
     $this->label = $this->label[0];
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Common::getRequestVar('period', '', 'string');
     PeriodFactory::checkPeriodIsEnabled($this->period);
     $this->idSite = $idSite;
     $this->graphType = $graphType;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         list($this->date, $lastN) = EvolutionViz::getDateRangeAndLastN($this->period, $end);
     }
     $this->segment = \Piwik\API\Request::getRawSegmentFromRequest();
     $this->loadEvolutionReport();
 }
開發者ID:drabberhorizon,項目名稱:ActiveNative,代碼行數:34,代碼來源:RowEvolution.php

示例6: forgetRememberedArchivedReportsToInvalidate

 /**
  * @internal
  */
 public function forgetRememberedArchivedReportsToInvalidate($idSite, Date $date)
 {
     $id = $this->buildRememberArchivedReportId($idSite, $date->toString());
     Option::delete($id);
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:8,代碼來源:ArchiveInvalidator.php

示例7: shouldReportBePurged

 /**
  * Returns true if a report with the given year & month should be purged or not.
  *
  * @param int $reportDateYear The year of the report in question.
  * @param int $reportDateMonth The month of the report in question.
  * @param Date $toRemoveDate The date a report must be older than in order to be purged.
  * @return bool
  */
 public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $toRemoveDate)
 {
     $toRemoveYear = (int) $toRemoveDate->toString('Y');
     $toRemoveMonth = (int) $toRemoveDate->toString('m');
     return $reportDateYear < $toRemoveYear || $reportDateYear == $toRemoveYear && $reportDateMonth <= $toRemoveMonth;
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:14,代碼來源:ReportsPurger.php

示例8: getAllOverlappingChildPeriodsInRange

 private function getAllOverlappingChildPeriodsInRange(Date $dateStart, Date $dateEnd)
 {
     $result = array();
     $childPeriodType = $this->getImmediateChildPeriodLabel();
     if (empty($childPeriodType)) {
         return $result;
     }
     $childPeriods = Factory::build($childPeriodType, $dateStart->toString() . ',' . $dateEnd->toString());
     return array_merge($childPeriods->getSubperiods(), $childPeriods->getAllOverlappingChildPeriodsInRange($dateStart, $dateEnd));
 }
開發者ID:drabberhorizon,項目名稱:ActiveNative,代碼行數:10,代碼來源:Period.php

示例9: getTableMonthFromDate

 public static function getTableMonthFromDate(Date $date)
 {
     return $date->toString('Y_m');
 }
開發者ID:nuxwin,項目名稱:piwik,代碼行數:4,代碼來源:ArchiveTableCreator.php

示例10: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Date $date ($this->date from controller)
  * @param null|string $graphType
  * @throws Exception
  */
 public function __construct($idSite, $date, $graphType = null)
 {
     $this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = ResponseBuilder::getLabelFromRequest($_GET);
     $this->label = $this->label[0];
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Common::getRequestVar('period', '', 'string');
     if (empty($this->period)) {
         throw new Exception("Parameter period not set.");
     }
     $this->idSite = $idSite;
     $this->graphType = $graphType;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         list($this->date, $lastN) = EvolutionViz::getDateRangeAndLastN($this->period, $end);
     }
     $this->segment = \Piwik\API\Request::getRawSegmentFromRequest();
     $this->loadEvolutionReport();
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:33,代碼來源:RowEvolution.php

示例11: removeDate

 public function removeDate(Date $date)
 {
     $yearMonth = $date->toString('Y_m');
     $this->remove($yearMonth);
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:5,代碼來源:ArchivesToPurgeDistributedList.php


注:本文中的Piwik\Date::toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。