Hi, I am using the following function to get the actual days between two given dates but it is having memory allocation issues.
$sStartDate = 2009-06-22;
$sEndDate = 2009-06-29;
function _GetDays($sStartDate, $sEndDate){
$sStartDate = gmdate("Y-m-d", strtotime($sStartDate));
$sEndDate = gmdate("Y-m-d", strtotime($sEndDate));
$aDays[] = $sStartDate;
$sCurrentDate = $sStartDate;
while($sCurrentDate < $sEndDate){
// Add a day to the current date
$sCurrentDate = gmdate("Y-m-d", strtotime("+1 day", strtotime($sCurrentDate)));
// Add this new day to the aDays array
$aDays[] = $sCurrentDate;
}
return $aDays;
}//EOF
What I am trying to do is get it to display 2009-06-22, ..23, ..24, 25, 26, 27, 28 and the 2009-06-29. This would be the days in between the start and end date including both dates.
Any help or a better code would be really appreciated.
Thanks