Home  >  Article  >  Backend Development  >  实现从指定时间向下推n个月的函数_PHP

实现从指定时间向下推n个月的函数_PHP

WBOY
WBOYOriginal
2016-06-01 12:40:491220browse

作者: bjbs_270
前一段时间做了一个月报表统计用下了如题的功能,结合别人用mktime()函数我写了一个可是后来老是出错,郁闷极。周末抽出一点时间写一个来用,但愿能对部分村民有用。

PHP代码:--------------------------------------------------------------------------------


/*
* 作者:心灯
* 功能:实现从指定时间向下推N个月的函数
* month($ymd,$len) $ymd时间,$len推出几个月
* $ymd='2005-01-01';
*/
function month($ymd=',$len='12'){
$month = array();
$lang = $lang."";
if($ymd){//

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
Previous article:结合PHP使用HTML表单_PHPNext article:linuxloadavg算法_PHP