Пример #1
0
 /**
  * Returns date of the last day of the month in the number of months
  * from the given date
  *
  * @param int    $months the number of months from the date provided.
  *                        Positive numbers go into the future.
  *                        Negative numbers go into the past.
  *                        0 is the month presented in $month.
  * @param string $month  the month, default is current local month
  * @param string $year   the year in four digit format, default is the
  *                        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
  * @since    Method available since Release 1.4.4
  */
 function endOfMonthBySpan($months = 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');
     }
     $hn_days = Date_Calc::addMonthsToDays($months + 1, Date_Calc::firstDayOfMonth($month, $year)) - 1;
     return Date_Calc::daysToDate($hn_days, $format);
 }