| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace Biz\Datetime;
- /**
- * basetime
- */
- class DateSeasons extends BaseTime {
- /**
- * 时间信息获取
- * @var string
- */
- public function parseTime($params){
- $res = $this->GetTimesSeason($params[0]);
- return $res;
- }
- //获取指定日期起始时间:季
- public function GetTimesSeason($type){
- $m = date('m',time());
- $sm = ceil($m/3);
- $sm = ($sm-1)*3+1;
- $curm = date("Y-$sm-1",time());
- if($type == 'pre'){
- $res['start'] = date('Y-m-d 00:00:00',strtotime($curm.'-3month'));
- $res['end'] = date('Y-m-d 23:59:59',strtotime($curm.'-1day'));
- }else if($type=='cur'){
- $res['start'] = date('Y-m-d 00:00:00',strtotime($curm));
- $res['end'] = date('Y-m-d 23:59:59',strtotime($curm.'+3month-1day'));
- }else{
- $res['start'] = date('Y-m-d 00:00:00',strtotime($curm.'+3month'));
- $res['end'] = date('Y-m-d 23:59:59',strtotime($curm.'+6month-1day'));
- }
- return $res;
- }
- }
|