public function getMonthListFromDate(Carbon $start)
{
$start = $start->startOfMonth();
$end = Carbon::today()->startOfMonth();
do
{
$months[$start->format('m-Y')] = $start->format('F Y');
} while ($start->addMonth() <= $end);
return $months;
}
Last active
August 12, 2021 22:13
-
-
Save mknparreira/11a330a1d2da281980a21e6483aeb276 to your computer and use it in GitHub Desktop.
Laravel | Getting all months between 2 dates Carbon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/29106854/getting-all-months-between-2-dates