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


PHP Time::diffInDays方法代码示例

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


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

示例1: testDiffInDays

 public function testDiffInDays()
 {
     $this->assertEquals(0, Time::diffInDays(mktime(0, 0, 0, 12, 5, 2000), mktime(0, 0, 0, 12, 5, 2000)));
     $this->assertEquals(0, Time::diffInDays(mktime(0, 0, 0, 12, 5, 2000), mktime(23, 59, 0, 12, 5, 2000)));
     $this->assertEquals(1, Time::diffInDays(mktime(0, 0, 0, 12, 5, 2000), mktime(0, 0, 0, 12, 6, 2000)));
     $this->assertEquals(5, Time::diffInDays(mktime(0, 0, 0, 12, 5, 2000), mktime(0, 0, 0, 12, 10, 2000)));
     $this->assertEquals(4, Time::diffInDays(mktime(17, 0, 0, 12, 5, 2000), mktime(15, 0, 0, 12, 10, 2000)));
     $this->assertEquals(5, Time::diffInDays(mktime(18, 0, 0, 12, 5, 2000), mktime(13, 0, 0, 12, 11, 2000)));
     $this->assertEquals(365, Time::diffInDays(mktime(0, 0, 0, 12, 5, 2000), mktime(0, 0, 0, 12, 5, 2001)));
 }
开发者ID:9x,项目名称:Runalyze,代码行数:10,代码来源:TimeTest.php

示例2: trainingIsTooOldToFetchWeatherData

 /**
  * Check: Is this training too old for weather forecast?
  * @return boolean
  */
 private function trainingIsTooOldToFetchWeatherData()
 {
     return Time::diffInDays($this->getTimestamp()) > 30;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:8,代码来源:class.TrainingObject.php

示例3: UNIX_TIMESTAMP

			FROM `' . PREFIX . 'training`
			WHERE
				`time` BETWEEN UNIX_TIMESTAMP("' . $StartDay . '" + INTERVAL -' . $AddDays . ' DAY) AND UNIX_TIMESTAMP("' . $StartDay . '" + INTERVAL ' . $NumberOfDays . ' DAY)-1
			GROUP BY `index`')->fetchAll();
    //	Cache::set('calculationsPlotData'.$Year.$All.$lastHalf.$lastYear, $Data, '300');
    //}
    foreach ($Data as $dat) {
        $index = $dat['index'] + $AddDays;
        $Trimps_raw[$index] = 1 * $dat['trimp'];
        if ($dat['vdot'] != 0) {
            $VDOTs_raw[$index] = $dat['vdot'];
            // Remember: These values are already multiplied with `s`
            $Durations_raw[$index] = (double) $dat['s'];
        }
    }
    $StartDayInYear = $All || $lastHalf || $lastYear ? Time::diffInDays($StartTime, mktime(0, 0, 0, 1, 1, $StartYear)) + 1 : 0;
    $LowestIndex = $AddDays + 1;
    $HighestIndex = $AddDays + 1 + $NumberOfDays;
    $VDOTdays = Configuration::Vdot()->days();
    $ATLdays = Configuration::Trimp()->daysForATL();
    $CTLdays = Configuration::Trimp()->daysForCTL();
    $TSBModel = new Runalyze\Calculation\Performance\TSB($Trimps_raw, $CTLdays, $ATLdays);
    $TSBModel->calculate();
    if ($All) {
        $maxATL = $TSBModel->maxFatigue();
        $maxCTL = $TSBModel->maxFitness();
        if ($maxATL != Configuration::Data()->maxATL()) {
            Configuration::Data()->updateMaxATL($maxATL);
        }
        if ($maxCTL != Configuration::Data()->maxCTL()) {
            Configuration::Data()->updateMaxCTL($maxCTL);
开发者ID:schoch,项目名称:Runalyze,代码行数:31,代码来源:Plot.Form.php

示例4: displayContent

 /**
  * Display the content
  * @see PluginPanel::displayContent()
  */
 protected function displayContent()
 {
     $this->showValues();
     if ($this->Configuration()->value('show_trainingpaces')) {
         $this->showPaces();
     }
     if (Time::diffInDays(START_TIME) < 70) {
         echo HTML::info(__('There are not enough activities for good calculations.'));
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:14,代码来源:class.RunalyzePluginPanel_Rechenspiele.php

示例5: getDaysForWeekKm

 /**
  * Get days used for week km for basic endurance
  * @return double 
  */
 public function getDaysForWeekKm()
 {
     $diff = Time::diffInDays(START_TIME);
     if ($diff > $this->DAYS_FOR_WEEK_KM) {
         return $this->DAYS_FOR_WEEK_KM;
     } elseif ($diff < $this->DAYS_FOR_WEEK_KM_MIN) {
         return $this->DAYS_FOR_WEEK_KM_MIN;
     }
     return $diff;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:14,代码来源:class.BasicEndurance.php

示例6: initDays

    /**
     * Init all days for beeing displayed
     */
    protected function initDays()
    {
        $this->initShortSports();
        $this->initEmptyDays();
        $WhereNotPrivate = FrontendShared::$IS_SHOWN && !Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
        $AllTrainings = $this->DB->query('
			SELECT
				id,
				time,
				`s` as `s_sum_with_distance`,
				DATE(FROM_UNIXTIME(time)) as `date`
				' . $this->Dataset->getQuerySelectForAllDatasets() . '
			FROM `' . PREFIX . 'training`
			WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . '
                        AND accountid = ' . SessionAccountHandler::getId() . '
				' . $WhereNotPrivate . '
			ORDER BY `time` ASC
		')->fetchAll();
        foreach ($AllTrainings as $Training) {
            $w = Time::diffInDays($Training['time'], $this->timestamp_start);
            if (in_array($Training['sportid'], $this->sports_short)) {
                $this->days[$w]['shorts'][] = $Training;
            } else {
                $this->days[$w]['trainings'][] = $Training;
            }
        }
    }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:30,代码来源:class.DataBrowser.php


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