有没有可能使用strtotime获取去年10月的数据?
例如strtotime("last October");
目前我正在使用它,但我更喜欢使用strtotime
date("Y-m-d", mktime(0,0,0,10,1,date("Y") - !(date(m) > 9)))
发布于 2014-04-01 21:01:37
您可以使用类似以下内容:
strtotime(date('Y-10-01') . (date('m') < 10 ? ' -1 year' : ''));不知道你想如何处理现在是10月份的情况。如果您希望它在去年10月显示,则将<更改为<=。
发布于 2014-04-01 21:07:47
在strtotime函数中,对于时间参数,您需要考虑所有适用的GNU语法。不确定是否可以直接使用字符串“去年10月”来获取时间戳值。有关更多信息,请参阅http://www.gnu.org/software/tar/manual/html_chapter/Date-input-formats.html。
https://stackoverflow.com/questions/22786532
复制相似问题