当前位置: 首页>>代码示例>>PHP>>正文


PHP Range::getDateXPeriodsAgo方法代码示例

本文整理汇总了PHP中Piwik\Period\Range::getDateXPeriodsAgo方法的典型用法代码示例。如果您正苦于以下问题:PHP Range::getDateXPeriodsAgo方法的具体用法?PHP Range::getDateXPeriodsAgo怎么用?PHP Range::getDateXPeriodsAgo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Period\Range的用法示例。


在下文中一共展示了Range::getDateXPeriodsAgo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLastDate

 public function getLastDate($date, $period, $comparedToXPeriods)
 {
     $pastDate = Range::getDateXPeriodsAgo(abs($comparedToXPeriods), $date, $period);
     if (empty($pastDate[0])) {
         throw new \Exception('Not possible to compare this date/period combination');
     }
     return $pastDate[0];
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:8,代码来源:Model.php

示例2: getOldestDateToProcessForNewSegment

 private function getOldestDateToProcessForNewSegment(Date $segmentCreatedTime)
 {
     if ($this->processNewSegmentsFrom == self::CREATION_TIME) {
         $this->logger->debug("process_new_segments_from set to segment_creation_time, oldest date to process is {time}", array('time' => $segmentCreatedTime));
         return $segmentCreatedTime;
     } elseif (preg_match("/^last([0-9]+)\$/", $this->processNewSegmentsFrom, $matches)) {
         $lastN = $matches[1];
         list($lastDate, $lastPeriod) = Range::getDateXPeriodsAgo($lastN, $segmentCreatedTime, 'day');
         $result = Date::factory($lastDate);
         $this->logger->debug("process_new_segments_from set to last{N}, oldest date to process is {time}", array('N' => $lastN, 'time' => $result));
         return $result;
     } else {
         $this->logger->debug("process_new_segments_from set to beginning_of_time or cannot recognize value");
         return null;
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:16,代码来源:SegmentArchivingRequestUrlProvider.php

示例3: getOldestDateToProcessForNewSegment

 private function getOldestDateToProcessForNewSegment($idSite, $segment)
 {
     /**
      * @var Date $segmentCreatedTime
      * @var Date $segmentLastEditedTime
      */
     list($segmentCreatedTime, $segmentLastEditedTime) = $this->getCreatedTimeOfSegment($idSite, $segment);
     if ($this->processNewSegmentsFrom == self::CREATION_TIME) {
         $this->logger->debug("process_new_segments_from set to segment_creation_time, oldest date to process is {time}", array('time' => $segmentCreatedTime));
         return $segmentCreatedTime;
     } elseif ($this->processNewSegmentsFrom == self::LAST_EDIT_TIME) {
         $this->logger->debug("process_new_segments_from set to segment_last_edit_time, segment last edit time is {time}", array('time' => $segmentLastEditedTime));
         if ($segmentLastEditedTime === null || $segmentLastEditedTime->getTimestamp() < $segmentCreatedTime->getTimestamp()) {
             $this->logger->debug("segment last edit time is older than created time, using created time instead");
             $segmentLastEditedTime = $segmentCreatedTime;
         }
         return $segmentLastEditedTime;
     } elseif (preg_match("/^last([0-9]+)\$/", $this->processNewSegmentsFrom, $matches)) {
         $lastN = $matches[1];
         list($lastDate, $lastPeriod) = Range::getDateXPeriodsAgo($lastN, $segmentCreatedTime, 'day');
         $result = Date::factory($lastDate);
         $this->logger->debug("process_new_segments_from set to last{N}, oldest date to process is {time}", array('N' => $lastN, 'time' => $result));
         return $result;
     } else {
         $this->logger->debug("process_new_segments_from set to beginning_of_time or cannot recognize value");
         return null;
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:SegmentArchivingRequestUrlProvider.php


注:本文中的Piwik\Period\Range::getDateXPeriodsAgo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。