Would like to retrieve all days and date for a given month. Have this currently which shows all the days for the current month, but how do I parse in a specified month instead?<
Take advantage of the relative formats.
$y_m = '2018-10'; // set year and month.
$list = array();
$d = date('d', strtotime('last day of this month', strtotime($y_m))); // get max date of current month: 28, 29, 30 or 31.
for ($i = 1; $i <= $d; $i++) {
$list[] = $y_m . '-' . str_pad($i, 2, '0', STR_PAD_LEFT);
}
echo '';
print_r($list);
echo '
';