Created
April 20, 2015 16:27
-
-
Save Roemerb/eb66d5bee8c6dbd5a4e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function calculate_days($from,$to) { | |
$aryRange=array(); | |
$iDateFrom=mktime(1,0,0,substr($from,5,2), substr($from,8,2),substr($from,0,4)); | |
$iDateTo=mktime(1,0,0,substr($to,5,2), substr($to,8,2),substr($to,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; | |
} | |
else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment