You are here

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

Modify to the first occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the first day of the current month. Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.

Parameters

int|null $dayOfWeek:

Return value

static

File

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

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function firstOfMonth($dayOfWeek = null) {
  $this
    ->startOfDay();
  if ($dayOfWeek === null) {
    return $this
      ->day(1);
  }
  return $this
    ->modify('first ' . static::$days[$dayOfWeek] . ' of ' . $this
    ->format('F') . ' ' . $this->year);
}