You are here

public function Carbon::diffInMonths in Persian Date for Drupal 8 8.4

Get the difference in months

Parameters

\Drupal\persian_date\Library\Carbon\Carbon|null $dt:

bool $abs Get the absolute of the difference:

Return value

int

File

src/Library/Carbon/Carbon.php, line 2592

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function diffInMonths(Carbon $dt = null, $abs = true) {
  $dt = $dt ?: static::now($this
    ->getTimezone());
  return $this
    ->diffInYears($dt, $abs) * static::MONTHS_PER_YEAR + (int) $this
    ->diff($dt, $abs)
    ->format('%r%m');
}