PHP bug strtotime
echo date('Y-m',strtotime('-1 months'));
echo "\r\n";
echo date('Y-m',strtotime('first day of last month'));
echo "\r\n";
echo date('Y-m',strtotime('-1 week'));
当遇到月为31日是 date('Y-m',strtotime('-1 months'));求的月份还是当月的
正确使用方式
echo date('Y-m',strtotime('first day of last month'));
echo date('Y-m-d H:i:s', strtotime('-1 month', strtotime(date('Y-m'))));
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。