<?php
namespace Biz\Datetime;
/**
 * basetime
 */
class DateWeeks extends BaseTime {
	/**
	 * 时间信息获取
	 * @var string
	 */
	public function parseTime($params){
		$res = $this->GetTimesWeek($params[0]);
		return $res;
	}

    //获取指定日期起始时间:周
    public function GetTimesWeek($type){
        $w = date('w',time());
        $s = ($w==0)?6:($w-1);
        $e = ($w==0)?0:(7-$w);
        $s = ($type=='cur')?$s:($type=='pre'?($s+7):($s-7));
        $e = ($type=='cur')?$e:($type=='pre'?($e-7):($e+7));
        $res['start'] = date('Y-m-d 00:00:00',time()-3600*24*$s);
        $res['end'] = date('Y-m-d 23:59:59',time()+3600*24*$e);
        return $res;
    }
}