Blogger Information
Blog 38
fans 0
comment 0
visits 30656
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
组装近三年按季度查询的时间节点
图图的博客
Original
884 people have browsed it

$now = time();

$year[] = (date('Y',time()))-2;
$year[] = (date('Y',time()))-1;
$year[] = (date('Y',time()));

$mon = array(1,4,7,10);
//组装近三年每个季度的节点
foreach ($year as $v){
   foreach ($mon as $j){
       $node_str[] = "'".$v."-".$j."'";
   }
}
for ($k=1;$k<count($node_str);$k++){

//根据时间节点循环查询
   $data[] = $db->select("select * from table1  where time between ".$node_str[$k-1]." and ".$node_str[$k]);
}

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments