今天是5月30号,使用strtotime("-1 month", time())得到的不是4月份,而是5月份。
解决方法是可以把时间戳先转换成年月,再减一月
$startTime = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month',strtotime(date('Y-m',time())))));
今天是5月30号,使用strtotime("-1 month", time())得到的不是4月份,而是5月份。
解决方法是可以把时间戳先转换成年月,再减一月
$startTime = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month',strtotime(date('Y-m',time())))));