您的位置:首页 > 编程语言 > PHP开发

PHP bug strtotime

2016-05-31 15:09 741 查看
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'))));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  error date strtotime