diff --git a/www/vicidial/functions.php b/www/vicidial/functions.php index ae4af200..1d88852c 100644 --- a/www/vicidial/functions.php +++ b/www/vicidial/functions.php @@ -1334,4 +1334,23 @@ function hex2rgb($hex) { return $rgb; // returns an array with the rgb values } +function createDateRangeArray($strDateFrom,$strDateTo) + { + $aryRange=array(); + + $iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2), substr($strDateFrom,8,2),substr($strDateFrom,0,4)); + $iDateTo=mktime(1,0,0,substr($strDateTo,5,2), substr($strDateTo,8,2),substr($strDateTo,0,4)); + + if ($iDateTo>=$iDateFrom) + { + array_push($aryRange,date('Y-m-d',$iDateFrom)); // first entry + while ($iDateFrom<$iDateTo) + { + $iDateFrom+=86400; // add 24 hours + array_push($aryRange,date('Y-m-d',$iDateFrom)); + } + } + return $aryRange; + } + ?>