下一个月和上个月从一个给定的月份在php [英] next and previous month from a given month in php

查看:150
本文介绍了下一个月和上个月从一个给定的月份在php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

从给定日期获取下一个月和上个月的最佳解决方案

我正在php开发一项工作。在这里,我想从特定月份获得下一个月和上个月,例如:

I am developing a work in php. Here I want to get next and previous month from a given month for example:

$ mth =December

我想显示12月的下一个和上一个

I want to display next and previous of December

提前感谢

推荐答案

$mth="December";
$next_mth = Date("F", strtotime($mth . " next month"));
$pre_mth = Date("F", strtotime($mth . " last month"));

这篇关于下一个月和上个月从一个给定的月份在php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆