获取月份前后的月份名称 [英] Get month after and before given month name
本文介绍了获取月份前后的月份名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在给定月份之后获取月份名称。所以对于6月份,我想要七月
How do I get the month name after a given month. So for June, I would want July
我尝试过:
$next_month = date('F',strtotime('June', "next month"));
这显示1月,显然是错的,我在找7月。
This display January, which is obviously wrong, I am looking for July.
我将如何获得前一个月?
How would I then get the month before?
我尝试过
$prev_month = date('F',strtotime('June - 1 month'));
推荐答案
$next_month = date('F',strtotime('June + 1 month'));
或
$next_month = date('F',strtotime('June next month'));
编辑
$next_month = date('F',strtotime('June last month'));
这篇关于获取月份前后的月份名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文