Skip to content

Instantly share code, notes, and snippets.

@imvaskii
Created March 20, 2015 07:42
Show Gist options
  • Save imvaskii/e4c5419125590d5592ca to your computer and use it in GitHub Desktop.
Save imvaskii/e4c5419125590d5592ca to your computer and use it in GitHub Desktop.
Get date range between start and end date
<?php
function returnDates($fromdate, $todate) {
$date_list = array();
$fromdate = date(strtotime($fromdate));
$todate = date(strtotime($todate));
for ($i = $fromdate; $i <= $todate; $i+=86400) {
array_push($date_list, date("Y/m/d H", $i));
}
return $date_list;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment