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


PHP Date_Calc::addDays方法代码示例

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


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

示例1: nextDay

 /**
  * Returns date of day after given date
  *
  * @param int    $day    the day of the month, default is current local day
  * @param int    $month  the month, default is current local month
  * @param int    $year   the year in four digit format, default is current
  *                        local year
  * @param string $format the string indicating how to format the output
  *
  * @return   string     the date in the desired format
  * @access   public
  * @static
  */
 function nextDay($day = 0, $month = 0, $year = null, $format = DATE_CALC_FORMAT)
 {
     if (is_null($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     return Date_Calc::addDays(1, $day, $month, $year, $format);
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:26,代码来源:Calc.php

示例2: subtractSpan

 /**
  * Subtracts a time span from the date
  *
  * N.B. it is impossible for this function to count leap seconds,
  * because the result would be dependent on which order the consituent
  * parts of the span are subtracted from the date.  Therefore, leap
  * seconds are ignored by this function.  If you want to count leap
  * seconds, use 'subtractSeconds()'.
  *
  * @param object $span the time span to subtract
  *
  * @return   void
  * @access   public
  */
 function subtractSpan($span)
 {
     if (!is_a($span, 'Date_Span')) {
         return PEAR::raiseError("Invalid argument - not 'Date_Span' object");
     } else {
         if ($this->ob_invalidtime) {
             return $this->_getErrorInvalidTime();
         }
     }
     $hn_days = -$span->day;
     $hn_standardhour = $this->on_standardhour - $span->hour;
     $hn_standardminute = $this->on_standardminute - $span->minute;
     $hn_standardsecond = $this->on_standardsecond - $span->second;
     if ($hn_standardsecond < 0) {
         --$hn_standardminute;
         $hn_standardsecond += 60;
     }
     if ($hn_standardminute < 0) {
         --$hn_standardhour;
         $hn_standardminute += 60;
     }
     if ($hn_standardhour < 0) {
         --$hn_days;
         $hn_standardhour += 24;
     }
     list($hn_standardyear, $hn_standardmonth, $hn_standardday) = explode(" ", Date_Calc::addDays($hn_days, $this->on_standardday, $this->on_standardmonth, $this->on_standardyear, "%Y %m %d"));
     $this->setStandardTime($hn_standardday, $hn_standardmonth, $hn_standardyear, $hn_standardhour, $hn_standardminute, $hn_standardsecond, $this->on_standardpartsecond);
 }
开发者ID:,项目名称:,代码行数:42,代码来源:


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