Home > php教程 > php手册 > body text

php生成按指定时间以来的,年、季度、月份的下拉列表

WBOY
Release: 2016-06-13 11:23:35
Original
2396 people have browsed it

php教程生成按指定时间以来的,年、季度、月份的下拉列表

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


/*
直接循环
如果是月,则循环变量每次增加1(月)
如果是年,则每次增加12(月),
同时输出date('Y-m')或者 date('Y')

*/


source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template