You are here

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

Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside the scope of the current month, 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 3186

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function nthOfMonth($nth, $dayOfWeek) {
  $dt = $this
    ->copy()
    ->firstOfMonth();
  $check = $dt
    ->format('Y-m');
  $dt
    ->modify('+' . $nth . ' ' . static::$days[$dayOfWeek]);
  return $dt
    ->format('Y-m') === $check ? $this
    ->modify($dt) : false;
}