Forum Moderators: coopster
$kill = date('Y-m-d',mktime(0, 0, 0, date("m",$born), date("d",$born)+180, date("Y",$born)));
echo $kill;
Why doen't this work? I want the code to calculate a given date ($born) + 180 days.
I see that you figured out that it is possible to use date() and mktime() together to find dates in the future. As the others have noted, you need to pass this function a timestamp and there are a number of ways to accomplish the task at hand. Another common method is to extract the pieces you need:
$born = '2006-01-17';
list($year, $month, $day) = explode [php.net]('-', $born);
$kill = date('Y-m-d', mktime(0, 0, 0, $month, $day + 180, $year));
echo $kill;