Skip to content

Instantly share code, notes, and snippets.

@nicolascb
Created March 5, 2018 13:44
Show Gist options
  • Save nicolascb/b084936da6ed946b79cb565b103d66b6 to your computer and use it in GitHub Desktop.
Save nicolascb/b084936da6ed946b79cb565b103d66b6 to your computer and use it in GitHub Desktop.
PHP - Get days of month
function GetDaysOfMonth($year, month){
$start_date = "01-".$month."-".$year;
$start_time = strtotime($start_date);
$end_time = strtotime("+1 month", $start_time);
for($i=$start_time; $i<$end_time; $i+=86400) {
$list[] = date('Y-m-d', $i);
}
return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment