Php 将月份添加到现有日期?

Php 将月份添加到现有日期?,php,Php,我有一个日期,需要加上几个月,但不知怎的,它返回了纪元日期 $duration = 28; $row['end_date'] = '2010-09-22 0000:00:00'; $newEndDate = date("Y-m-d", strtotime(" +".$duration." month",substr($row['end_date'],0,10))); 改用这个: $date = date("Y-m-d");// current date $date = strtotime

我有一个日期,需要加上几个月,但不知怎的,它返回了纪元日期

$duration = 28;
$row['end_date'] = '2010-09-22 0000:00:00';

$newEndDate =  date("Y-m-d", strtotime(" +".$duration." month",substr($row['end_date'],0,10)));
改用这个:

$date = date("Y-m-d");// current date

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");
改用这个:

$date = date("Y-m-d");// current date

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");