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


PHP Range::setDefaultEndDate方法代码示例

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


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

示例1: getTemperaturesEvolution

 public function getTemperaturesEvolution($date, $period)
 {
     $temperatures = array();
     $date = Date::factory('2013-10-10', 'UTC');
     $period = new Range($period, 'last30');
     $period->setDefaultEndDate($date);
     foreach ($period->getSubperiods() as $subPeriod) {
         if (self::$disableRandomness) {
             $server1 = 50;
             $server2 = 40;
         } else {
             $server1 = mt_rand(50, 90);
             $server2 = mt_rand(40, 110);
         }
         $value = array('server1' => $server1, 'server2' => $server2);
         $temperatures[$subPeriod->getLocalizedShortString()] = $value;
     }
     return DataTable::makeFromIndexedArray($temperatures);
 }
开发者ID:piwik,项目名称:piwik,代码行数:19,代码来源:API.php

示例2: getRelativeToEndDate

 /**
  * Returns a date range string given a period type, end date and number of periods
  * the range spans over.
  *
  * @param string $period The sub period type, `'day'`, `'week'`, `'month'` and `'year'`.
  * @param int $lastN The number of periods of type `$period` that the result range should
  *                   span.
  * @param string $endDate The desired end date of the range.
  * @param Site $site The site whose timezone should be used.
  * @return string The date range string, eg, `'2012-01-02,2013-01-02'`.
  * @api
  */
 public static function getRelativeToEndDate($period, $lastN, $endDate, $site)
 {
     $last30Relative = new Range($period, $lastN, $site->getTimezone());
     $last30Relative->setDefaultEndDate(Date::factory($endDate));
     $date = $last30Relative->getDateStart()->toString() . "," . $last30Relative->getDateEnd()->toString();
     return $date;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:19,代码来源:Range.php

示例3: testCustomRangePreviousN

 public function testCustomRangePreviousN()
 {
     $range = new Range('range', 'previous3');
     $range->setDefaultEndDate(Date::factory('2008-01-03'));
     $correct = array('2007-12-31', '2008-01-01', '2008-01-02');
     $this->assertEquals(count($correct), $range->getNumberOfSubperiods());
     $this->assertEquals($correct, $range->toString());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:RangeTest.php


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