Return current date plus 7 days
strtotime
will automatically use the current unix timestamp to base your string annotation off of.
Just do:
$date = strtotime("+7 day");
echo date('M d, Y', $date);
Added Info For Future Visitors: If you need to pass a timestamp to the function, the below will work.
This will calculate 7 days
from yesterday:
$timestamp = time()-86400;
$date = strtotime("+7 day", $timestamp);
echo date('M d, Y', $date);
$date = new DateTime(date("Y-m-d"));
$date->modify('+7 day');
$tomorrowDATE = $date->format('Y-m-d');
If it's 7 days from now that you're looking for, just put:
$date = strtotime("+7 day", time());
echo date('M d, Y', $date);
$now = date('Y-m-d');
$start_date = strtotime($now);
$end_date = strtotime("+7 day", $start_date);
echo date('Y-m-d', $start_date) . ' + 7 days = ' . date('Y-m-d', $end_date);
<?php
print date('M d, Y', strtotime('+7 days') );