首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PHP strtotime:获取上个月

PHP strtotime:获取上个月
EN

Stack Overflow用户
提问于 2012-12-31 22:14:55
回答 2查看 45.9K关注 0票数 20

可能重复:

How to get previous month and year relative to today, using strtotime and date?

今天是12月31日,但strtotime("-1 months")返回12月:

代码语言:javascript
复制
echo date("Y-m", strtotime("-1 months"));

strtotime("last month")也是如此

如何正确返回上个月(11月份)?

测试:http://codepad.viper-7.com/XvMaMB

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14102625

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档