Home  >  Article  >  Backend Development  >  php 日期 月份解决办法

php 日期 月份解决办法

WBOY
WBOYOriginal
2016-06-13 11:45:531007browse

php 日期 月份
php 开发 已知指定的年月份,例如为2013-12,如何获取下个月的月份?
------解决方案--------------------

<br />$first_day_of_month = "2013-12";<br /> $t = strtotime($first_day_of_month);<br /> print_r(array(<br />             date('Y-m',$t),<br />             date('Y-m',strtotime('+ 1 month',$t))<br /> ));<br />

------解决方案--------------------
echo date('Y-m', strtotime('2013-12-01 +1 month'));
2014-01

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn