使用PHP添加开始日期和结束日期

I would like to know how to add in new start and end date using PHP. this is my current coding:

$startdate = date_create(); echo date_format($startdate, 'Y-m-d'); 

$enddate = date_create(); echo date_format($enddate, 'Y-m-d'); 

$actualdate= strtotime('+1 Week', $enddate); 

The end result will always be the current date and not the one that I've insert in. Please help me. Thanks

You can try this -

echo $startdate = date('Y-m-d'); // current date
echo $enddate = date('Y-m-d', strtotime(' + 1 week')); // date 1 week

O/P

2015-11-04
2015-11-11

Start date manually -

    echo $startdate = date('Y-m-d', strtotime('2015-10-04')); 

To add one week in date use

$enddate = date('Y-m-d', strtotime('+1 week'));

You should use the DateTime class from PHP(>= 5.2.0). Here is an example how to add 1 week of current date:

$startdate = new \DateTime('now');
$startdate->modify('+1 week');
$enddate = $startdate->format('Y-m-d');

echo $enddate;

http://php.net/manual/en/class.datetime.php