Home  >  Article  >  Backend Development  >  PHP generates a drop-down list of years, quarters, and months since the specified time_PHP Tutorial

PHP generates a drop-down list of years, quarters, and months since the specified time_PHP Tutorial

WBOY
WBOYOriginal
2016-07-20 11:07:391250browse

php tutorial generates a drop-down list of year, quarter and month since the specified time

function countSeason($start,$end){
$temp = date("Y-m",strtotime( "$start +3month"));
while ($temp <= $end){
$time[] = $temp;
$temp = date("Y-m",strtotime("$ temp +3month"));
}
return $time;
}
$time = countSeason("2008-10",date("Y-m"));
?>


/*
Loop directly
If it is a month, the loop variable will increase by 1 (month) each time
If it is a year, it will increase by 12 (month) each time,
At the same time, output date('Y -m') or date('Y')

*/


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444940.htmlTechArticlephp tutorial generates a drop-down list of year, quarter and month since the specified time function countSeason($start,$ end){ $temp = date(Y-m,strtotime($start +3month)); while ($temp = $end){...
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