I have found several posts regarding this topic but I cannot get my function to work.
If the amount of days to add > 0
, the returning date = 70-01-01
Example: $date='12-07-11' $days='5'
Should return 17-07-11
instead of 70-01-01
I need to use the variables because $date and $days are results from an oracle query.
function addDayswithdate($date,$days)
{
$originalDate = $date;
$newDate = date("y-m-d", strtotime($originalDate));
if ($days>0)
{
$var="+". $days ." days";
$date = strtotime($var, strtotime($newDate));
}
$originalDate = $date;
$newDate = date("y-m-d", strtotime($date));
return $newDate;
}