我想给这个日期加 5 分钟:2011-04-8 08:29:49
$date = '2011-04-8 08:29:49';
当我使用 strtotime
时,我总是得到 1970-01-01 08:33:31
如何在 2011-04-8 08:29:49
中正确添加 5 分钟?
最佳答案
$date = '2011-04-8 08:29:49';
$currentDate = strtotime($date);
$futureDate = $currentDate+(60*5);
$formatDate = date("Y-m-d H:i:s", $futureDate);
现在,结果是 2011-04-08 08:34:49 并存储在 $formatDate
尽情享受吧! :)
关于php - 如何在 php < 5.3 上向当前日期时间添加 5 分钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5608967/