php⽉份加减最简单的处理方法php
php⽉份加减最简单的处理方法...
从PHP5.3开始, date新增了⼀系列修正短语, 来明确这个问题, 那就是first day of和last day of,如下:
月份减一:
$month = date("Y-m-d", strtotime("last day of -1 month", strtotime("2022-07-25")));
月份加一:
$month = date("Y-m-d", strtotime("first day of +1 month", strtotime("2022-07-25")));
下一篇:PHP合并数组并追加数组范例代码
最新评论
热门推荐
我要评论