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'));微信


wKioL1dNOUbj1HINAAAHSdy4nws384.png-wh_50


當遇到月爲31日是 date('Y-m',strtotime('-1 months'));求的月份仍是當月的ide

正確使用方式
blog

echo date('Y-m',strtotime('first day of last month'));get


echo date('Y-m-d H:i:s', strtotime('-1 month', strtotime(date('Y-m'))));it

相關文章
相關標籤/搜索