Answers for "Get All dates of a month"

PHP
0

Get All dates of a month

get all of dates ( day ) from a month...

$month = '2015-01';
$start = Carbon::parse($month)->startOfMonth();
$end = Carbon::parse($month)->endOfMonth();

$dates = [];
while ($start->lte($end)) {
     $dates[] = $start->copy();
     $start->addDay();
}

echo "<pre>", print_r($dates), "</pre>";
Posted by: Guest on January-16-2022

Code answers related to "Get All dates of a month"

Browse Popular Code Answers by Language