Reputation: 113
How can I find the number of Friday in the current month? I can use Carbon in my project.
I have used Carbon::now()->Friday();
This isn't working.
Can anybody help?
Upvotes: 1
Views: 335
Reputation: 5056
$now = CarbonImmutable::now();
echo CarbonPeriod::create($now->startOfMonth(), $end->endOfMonth())
->filter(static fn ($date) => $date->is('Friday'))
->count();
Upvotes: 2