【发布时间】:2013-12-11 13:07:51
【问题描述】:
我正在从数据库中获取日期并将其存储在名为$lastRequest[1] 的变量中。现在我需要将存储在变量$licChkFreq 中的特定天数添加到存储在$lastRequest[1] 中的日期。
我正在使用此代码:
$nextRequest=$newExp = strtotime(date("Y-m-d", strtotime($lastRequest[1])) . " +".$licChkFreq." day");
$nextRequest=date("Y-m-d",$nextRequest);
【问题讨论】:
-
如果我理解正确,你想添加日期,对吗?
-
使用天而不是天。已经在这里回答了。 stackoverflow.com/questions/3727615/adding-days-to-date-in-php
-
将前一个日期增加一定天数
-
日复一日没有任何区别
-
如果我有以下值 $lastRequest[1]=2013-12-11 , $licChkFreq=7 我会关注 nextRequest=601200 和第二次 nextRequest=1970-01-08 虽然它应该是2013-12-18