| @@ 2386-2395 (lines=10) @@ | ||
| 2383 | * |
|
| 2384 | * @return static |
|
| 2385 | */ |
|
| 2386 | public function firstOfMonth($dayOfWeek = null) |
|
| 2387 | { |
|
| 2388 | $date = $this->startOfDay(); |
|
| 2389 | ||
| 2390 | if ($dayOfWeek === null) { |
|
| 2391 | return $date->day(1); |
|
| 2392 | } |
|
| 2393 | ||
| 2394 | return $this->modify('first '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->getYear()); |
|
| 2395 | } |
|
| 2396 | ||
| 2397 | /** |
|
| 2398 | * Modify to the last occurrence of a given day of the week |
|
| @@ 2407-2416 (lines=10) @@ | ||
| 2404 | * |
|
| 2405 | * @return static |
|
| 2406 | */ |
|
| 2407 | public function lastOfMonth($dayOfWeek = null) |
|
| 2408 | { |
|
| 2409 | $date = $this->startOfDay(); |
|
| 2410 | ||
| 2411 | if ($dayOfWeek === null) { |
|
| 2412 | return $date->day($this->getDaysInMonth()); |
|
| 2413 | } |
|
| 2414 | ||
| 2415 | return $this->modify('last '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->getYear()); |
|
| 2416 | } |
|
| 2417 | ||
| 2418 | /** |
|
| 2419 | * Modify to the given occurrence of a given day of the week |
|