i have createed a function to work out a date at some point in the future, passing to it three arguments, the date to begin from, the amount of days to add and whether to display the output or not. This works fine just to display the result but i need to capture the output as a variable as i need to use the function a number of times and keep the different outputs separate, i.e. week2, week3, week4
this is the funtion:
function futDate($initDate, $duration, $display)
{
$dateSplit = split('/', $initDate);
$myDate = mktime(0,0,0,$dateSplit[1],$dateSplit[0],$dateSplit[2]);
$laterDate = $myDate + (60 * 60 * 24 * $duration);
$laterDate = date('d/m/Y', $laterDate);
if($display == true)
{
echo $laterDate;
}
}
this is how i need to use it, to work out the date of that day for the next 3 weeks:
echo $day_period;//initial date: UK FORMAt(dd/mm/yyyy)
echo "<br>";
futDate($day_period, 7, true);
echo "<br>";
futDate($day_period, 14, true);
echo "<br>";
futDate($day_period, 21, true);
i've tried just doing
$week2=(futDate($day_period, 7, true));
but when i output the var it is empty??
Thanks.