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