Return current date plus 7 days

Viewed 167274

I'm Trying to get the current date plus 7 days to display.

Example: Today is August 16, 2012, so this php snippet would output August 23, 2012.

   $date = strtotime($date);
   $date = strtotime("+7 day", $date);
   echo date('M d, Y', $date);

Right now, I'm getting: Jan 08, 1970. What am I missing?

10 Answers
echo date('d-m-Y', strtotime('+7 days'));
$date = strtotime("+7 day", strtotime("M d, Y"));
$date =  date('j M, Y', $date);

This will work as well

Here is how you can do it using strtotime(),

<?php
    $date = strtotime("3 October 2005");
    $d = strtotime("+7 day", $date);
    echo "Created date is " . date("Y-m-d h:i:sa", $d) . "<br>";
?>
Related