我正在尝试获取距我指定日期一年的日期。
我的代码如下所示:
$futureDate=date('Y-m-d', strtotime('+one year', $startDate));
它返回了错误的日期。任何想法为什么?
最佳答案
$futureDate=date('Y-m-d', strtotime('+1 year'));
$futureDate 是一年后!
$futureDate=date('Y-m-d', strtotime('+1 year', strtotime($startDate)) );
$futureDate 距离 $startDate 一年!
关于php - $日期 + 1 年?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1905048/