Reputation: 37
I am beginner in Laravel and PH{ I have this code:
$dateFrom = '2020-01-14';
$dateTo = '2020-02-19';
I need show date with day name (in Polish) between this dates.
I need result in this form:
2020-01-14 - Tuesday (Wtorek) 2020-01-15 - Wednesday (Środa)
How can I make it?
Upvotes: 0
Views: 280
Reputation: 4813
//...
Carbon::setLocale('pl');
$period = CarbonPeriod::create('2020-01-14', '2020-02-19');
// Iterate over the period
foreach ($period as $date) {
echo '(' . $date->format('l') . ')' . $date->format('Y-m-d');
}
//...
Upvotes: 2