Cake\Chronos\Traits\DifferenceTrait::diffInMonths PHP Method

diffInMonths() public method

Get the difference in months
public diffInMonths ( Cake\Chronos\ChronosInterface $dt = null, boolean $abs = true ) : integer
$dt Cake\Chronos\ChronosInterface The instance to difference from.
$abs boolean Get the absolute of the difference
return integer
    public function diffInMonths(ChronosInterface $dt = null, $abs = true)
    {
        $dt = $dt === null ? static::now($this->tz) : $dt;
        return $this->diffInYears($dt, $abs) * ChronosInterface::MONTHS_PER_YEAR + (int) $this->diff($dt, $abs)->format('%r%m');
    }