php產生按指定時間以來的,年、季度、月份的下拉式清單_PHP教程

來源:互聯網
上載者:User
php教程產生按指定時間以來的,年、季度、月份的下拉式清單

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"));
?>
按季度查看 年 第 $temp = intval(substr($val,5,2)); if (0<$temp&&$temp<4) {echo "1";} elseif (3<$temp&&$temp<7) {echo "2";} elseif (6<$temp&&$temp<10) {echo "3";} else {echo "4";} ?>季度


/*
直接迴圈
如果是月,則迴圈變數每次增加1(月)
如果是年,則每次增加12(月),
同時輸出date('Y-m')或者 date('Y')

*/


http://www.bkjia.com/PHPjc/444940.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444940.htmlTechArticlephp教程產生按指定時間以來的,年、季度、月份的下拉式清單 function countSeason($start,$end){ $temp = date(Y-m,strtotime($start +3month)); while ($temp = $end){...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.