You are here

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

Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside the scope of the current quarter, then return false and no modifications are made. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int $nth:

int $dayOfWeek:

Return value

mixed

File

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

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function nthOfQuarter($nth, $dayOfWeek) {
  $dt = $this
    ->copy()
    ->day(1)
    ->month($this->quarter * static::MONTHS_PER_QUARTER);
  $lastMonth = $dt->month;
  $year = $dt->year;
  $dt
    ->firstOfQuarter()
    ->modify('+' . $nth . ' ' . static::$days[$dayOfWeek]);
  return $lastMonth < $dt->month || $year !== $dt->year ? false : $this
    ->modify($dt);
}