我想在这个日期添加20秒:"2017-08-31T23:59:59+02:00"
。我试过这个:
// add 20s to orderDate
$s = 20;
$oldDate = $order->effectiveDate;
$date = new DateTime($oldDate);
$date->add(new DateInterval('PT'.$s.'S'));
$effectiveDate = date("Y-m-d", $date);
// store new date
$index['effectiveDate'] = $effectiveDate;
但$effectiveDate
是假的。我认为它与DateTime到日期的转换有关吗?