Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$date = '2012-07-25 00:05'; $delay = '25';
有没有一种简单的方法可以将 $delay 添加到 $date 中?结果必须是“2012-07-25 00:30”。
这是一种方法:
$new_date = date("Y-m-d H:i", strtotime($date . " +" . $delay . " minutes"));
这是另一个:
$date = new DateTime($date); $date->add(new DateInterval('P'.$delay.'i')); $new_date = $date->format('Y-m-d H:i')