本文介绍了PHP至今增加1个月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个函数返回1个月前的网址。
我想显示当前选定的月份,但是我不能使用简单的当前月份当用户点击链接到1个月后,选择的月份将更改,并且将不会是当前的。
因此,函数返回2012年8月
/ p> $ p $ p $ p $ b <?php echo strip_tags(tribe_get_previous_month_text()); ?>解决方案
简单方法:
$ next_month = strtotime('下个月'八月2012');更好的方法:
$ d = new Date('August 2012'); $ next_month = $ d-> add(new DateInterval('P1M'));相关文档: strtotime date dateinterval
I've a function that returns url of 1 month before.
I'd like to display current selected month, but I cannot use simple current month, cause when user clicks link to 1 month back selected month will change and will not be current.
So, function returns August 2012
How do I make little php script that adds 1 month to that?
so far I've:
<?php echo strip_tags(tribe_get_previous_month_text()); ?>解决方案
simple method:
$next_month = strtotime('august 2012 next month');better method:
$d = new Date('August 2012'); $next_month = $d->add(new DateInterval('P1M'));relevant docs: strtotime date dateinterval
更多推荐
PHP至今增加1个月
发布评论