本文整理汇总了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)));
}
示例2: trainingIsTooOldToFetchWeatherData
/**
* Check: Is this training too old for weather forecast?
* @return boolean
*/
private function trainingIsTooOldToFetchWeatherData()
{
return Time::diffInDays($this->getTimestamp()) > 30;
}
示例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);
示例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.'));
}
}
示例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;
}
示例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;
}
}
}