Logo Search packages:      
Sourcecode: davical version File versions  Download package

iCalDate::AddMonths ( mo )

Add some number of months to a date

Definition at line 228 of file RRule.php.

References _EpochFromParts(), _TextFromEpoch(), and DaysInMonth().

                            {
    dbg_error_log( "RRule", " Adding %d months to %s", $mo, $this->_text );
    $this->_mo += $mo;
    while ( $this->_mo < 1 ) {
      $this->_mo += 12;
      $this->_yy--;
    }
    while ( $this->_mo > 12 ) {
      $this->_mo -= 12;
      $this->_yy++;
    }

    if ( ($this->_dd > 28 && $this->_mo == 2) || $this->_dd > 30 ) {
      // Ensure the day of month is still reasonable and coerce to last day of month if needed
      $dim = $this->DaysInMonth();
      if ( $this->_dd > $dim ) {
        $this->_dd = $dim;
      }
    }
    $this->_EpochFromParts();
    $this->_TextFromEpoch();
    dbg_error_log( "RRule", " Added %d months and got %s", $mo, $this->_text );
  }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index