如何使用PHP获取当前月份和前三个月 [英] How can i get the current month and previous three months using PHP
本文介绍了如何使用PHP获取当前月份和前三个月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人告诉我如何使用PHP获取当前月份和前三个月
例如:
echo $ {pre>
echo date(y:M:d);
输出将为:09:10:20
但我需要:
August
9月
10月
作为输出。
提前感谢...
Fero
解决方案
您需要通过F的全文本表示:
echo date(y:F:d);
上个月可以使用
回显日期(y:F:d,strtotime( - 1个月));
Will any one tell me how to get the current month and previous three months using PHP
For example:
echo date("y:M:d");
output will be: 09:Oct:20
But i need:
August
September
October
as the Output.
Thanks in advance...
Fero
解决方案
for full textual representation of month you need to pass "F":
echo date("y:F:d");
for previous month you can use
echo date("y:F:d",strtotime("-1 Months"))
;
这篇关于如何使用PHP获取当前月份和前三个月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文