我需要用php获取下个月的信息。这些例子无处不在
date('Y-m-t',strtotime("+1 month"))
Run Code Online (Sandbox Code Playgroud)
上面的代码输出为“ 2017-03-31”。我需要二月而不是三月。
像这样使用
// One month from today
$date = date('Y-m-d', strtotime('+1 month'));
// One month from a specific date
$date = date('Y-m-d', strtotime('+1 month', strtotime('2015-01-01')));
Run Code Online (Sandbox Code Playgroud)
小智 6
如果要获取下一个而不考虑当前月份中的当前日期。下面的代码可能会帮助您
echo date('M',strtotime('first day of +1 month'));
Run Code Online (Sandbox Code Playgroud)
这会给你“二月”
| 归档时间: |
|
| 查看次数: |
8509 次 |
| 最近记录: |