草庐IT

PHP strtotime : Get previous month

coder 2023-06-14 原文

<分区>

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

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

echo date("Y-m", strtotime("-1 months"));

对于 strtotime("last month") 也是如此

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

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

有关PHP strtotime : Get previous month的更多相关文章

随机推荐