我有一个变量名为 $effectiveDate
,其中包含日期2012-03-26。
我尝试在这个日期上加三个月,但一直没有成功。
以下是我尝试过的方法:
$effectiveDate = strtotime("+3 months", strtotime($effectiveDate));
并且$effectiveDate = strtotime(date("Y-m-d", strtotime($effectiveDate)) . "+3 months");
我做错了什么?两段代码都没有起作用。
1340649000
,看起来是正确的。 - Dogbert$effectiveDate
存储的是你想要的内容吗?这个链接对我有效。 - Joshdate('Y-m-d', 1340661600)
给出的结果是2012-06-26
,这是正确的。 - Tchoupistrtotime
函数。该函数期望传入一个包含英文日期格式的字符串,并尝试将其解析为Unix时间戳。 - PenguinCoder