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 判断变量是否为null
最新评论
热门推荐
我要评论