【发布时间】:2011-05-31 04:10:39
【问题描述】:
到目前为止,这只发生在 31 日
echo date('F',strtotime('this month')); //May
echo date('F',strtotime('next month'));//July
echo date('F',strtotime('+1 month'));//July
据我所知,六月是在五月之后。但我猜 php 只是从现在开始添加 31 天,跳过整整一个月。
无论多长时间,我怎样才能安全地度过下个月?理想情况下使用 strttotime
edit忘了说,为什么我希望使用 strtotime 是因为我正在使用搜索框来查找解释用户输入 strtotime 的事件
【问题讨论】:
-
在 strtotime 文档的 cmets 中提到:php.net/manual/en/datetime.formats.relative.php#103206
-
另外,请务必将 cmets 阅读至 bugs.php.net/bug.php?id=22486。应该强调的是,这不是错误,而是预期的行为。有关更多信息,请参阅gnu.org/software/tar/manual/html_node/…。