PHP bug strtotime

发布时间:2020-06-20 04:35:26 作者:oyjjpp
来源:网络 阅读:620

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


PHP bug strtotime


当遇到月为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'))));

推荐阅读:
  1. php 日期处理
  2. PHP如何使用strtotime()函数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

error date strtotime

上一篇:Sqoop ETL工具的基本操作

下一篇:检测出栈的合法性问题

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》