本文整理汇总了PHP中Tinebase_DateTime::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_DateTime::add方法的具体用法?PHP Tinebase_DateTime::add怎么用?PHP Tinebase_DateTime::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_DateTime
的用法示例。
在下文中一共展示了Tinebase_DateTime::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUTCDateDstFix
/**
* adds diff to date and applies dst fix
*
* @param Tinebase_DateTime $_dateInUTC
* @param DateTimeInterval $_diff
* @param string $_timezoneForDstFix
*/
public static function addUTCDateDstFix($_dateInUTC, $_diff, $_timezoneForDstFix)
{
$_dateInUTC->setTimezone($_timezoneForDstFix);
$_dateInUTC->add($_dateInUTC->get('I') ? 1 : 0, Tinebase_DateTime::MODIFIER_HOUR);
$_dateInUTC->add($_diff);
$_dateInUTC->subHour($_dateInUTC->get('I') ? 1 : 0);
$_dateInUTC->setTimezone('UTC');
}
示例2: _getFirstAndLastDayOfWeek
/**
* get string representation of first and last days of the week defined by date/week number
*
* @param Tinebase_DateTime $_date
* @param integer $_weekNumber optional
* @return array
*/
protected function _getFirstAndLastDayOfWeek(Tinebase_DateTime $_date, $_weekNumber = NULL)
{
$firstDayOfWeek = $this->_getFirstDayOfWeek();
if ($_weekNumber !== NULL) {
$_date->setWeek($_weekNumber);
}
$dayOfWeek = $_date->get('w');
// in some locales sunday is last day of the week -> we need to init dayOfWeek with 7
$dayOfWeek = $firstDayOfWeek == 1 && $dayOfWeek == 0 ? 7 : $dayOfWeek;
$_date->sub($dayOfWeek - $firstDayOfWeek, Tinebase_DateTime::MODIFIER_DAY);
$firstDay = $_date->toString($this->_dateFormat);
$_date->add(6, Tinebase_DateTime::MODIFIER_DAY);
$lastDay = $_date->toString($this->_dateFormat);
$result = array($firstDay, $lastDay);
return $result;
}