标签:div star == 时间 时间戳 tar mkt bsp lse
if( $type == 1) {//当天 $time[‘start‘] = mktime(0, 0, 0, date(‘m‘), date(‘d‘), date(‘y‘)); $time[‘end‘] = mktime(0, 0, 0, date(‘m‘), date(‘d‘) + 1, date(‘y‘))-1; }else if($type==2){ //周 $time[‘start‘] = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); $time[‘end‘] = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")); } else if($type==3){ //月 $time[‘start‘] = mktime(0, 0 , 0,date("m"),1,date("Y")); $time[‘end‘] = mktime(23,59,59,date("m"),date("t"),date("Y")); }else if($type == 4){ //季度 $season = ceil((date(‘n‘))/3);//当月是第几季度 $time[‘start‘] = mktime(0, 0, 0,$season*3-3+1,1,date(‘Y‘)); $time[‘end‘] = mktime(23,59,59,$season*3,date(‘t‘,mktime(0, 0 , 0,$season*3,1,date("Y"))),date(‘Y‘)); }else if($type == 5 ){ //年 $time[‘start‘] = mktime(0, 0, 0,1,1,date(‘Y‘)); $time[‘end‘] = mktime(23,59,59,12,31,date("Y")); }
php 根据当日时间,计算出本日,周,月,季,年,时间戳范围
标签:div star == 时间 时间戳 tar mkt bsp lse
原文地址:https://www.cnblogs.com/fudongdong/p/9242813.html