如何使用 php strftime 添加一天


How to add a day to using php strftime

如果我正在格式化这样的日期并想添加一天,有没有办法使用 strftime 执行此操作?

_%Y%m%d

所以我可以这样做:

20120704

我想你正在寻找strtotime()。 像这样:

$date = date('Ymd', strtotime('+1 day'));
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
最好

将日期时间类用于日期。

$date = new DateTime('2012-07-03');
$date->add(new DateInterval('P1D'));
echo $date->format('Ymd') . "'n"; // Will echo 20120704