如何获得上个月和下个月? [英] How to get the previous and next month?
本文介绍了如何获得上个月和下个月?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$year = 2010;
$month = 10;
如何获得上个月 2010-09
和下个月 2010-11
?
How do I get the previous month 2010-09
and next month 2010-11
?
推荐答案
$date = mktime( 0, 0, 0, $month, 1, $year );
echo strftime( '%B %Y', strtotime( '+1 month', $date ) );
echo strftime( '%B %Y', strtotime( '-1 month', $date ) );
这篇关于如何获得上个月和下个月?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文