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'))));
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'))));
相关文章推荐
- 访问Nginx发生SSL connection error的一种情况
- 星外虚拟主机访问被控出现Unspecified error解决方法
- IIS 错误 Server Application Error 详细解决方法
- On Error Resume Next 语句
- IIS运行错误 Server Application Error 错误代码 Error: 8004的解决方法
- dos 日期时间格式设置使用小结(Date和Time)
- Lua编程示例(一):select、debug、可变参数、table操作、error
- 收集整理的http/1.1 500 server error错误的解决方法
- SQL 2005 ERROR:3145 解决办法(备份集中的数据库备份与现有的数据库不同)
- DOS批处理之DATE命令的使用方法详解
- VBScript中On Error语句用法小结
- 如何解决ORA-01843与NLS_DATE_FORMAT问题
- ExtJs的Date格式字符代码
- 解决VC++编译报错error C2248的方案
- PHP中Date获取时间不正确怎么办
- PHP strtotime函数用法、实现原理和源码分析
- Insert Date and Time into Access
- JavaScript:Date类型全面解析
- JavaScript下的时间格式处理函数Date.prototype.format
- jQuery Uploadify 上传插件出现Http Error 302 错误的解决办法