- 得到小时的起止时间
function getHourRange($date){
$ret=array();
$timestamp=strtotime($date);
$ret['sdate']=date('Y-m-d H:00:00',$timestamp);
$ret['edate']=date('Y-m-d H:59:59',$timestamp);
return $ret;
}
- 得到天的起止时间
function getHourRange($date){
$ret=array();
$timestamp=strtotime($date);
$ret['sdate']=date('Y-m-d 00:00:00',$timestamp);
$ret['edate']=date('Y-m-d 23:59:59',$timestamp);
return $ret;
}
- 得到星期的起止时间
function getWeekRange($date){
$ret=array();
$timestamp=strtotime($date);
$w=date('w',$timestamp);
$w = $w==0 ? 7 : $w;
$ret['sdate']=date('Y-m-d 00:00:00',$timestamp-($w-1)*86400);
$ret['edate']=date('Y-m-d 23:59:59',$timestamp+(7-$w)*86400);
return $ret;
}
- 得到月的起止时间
function getMonthRange($date){
$ret=array();
$timestamp=strtotime($date);
$mdays=date('t',$timestamp);
$ret['sdate']=date('Y-m-1 00:00:00',$timestamp);
$ret['edate']=date('Y-m-'.$mdays.' 23:59:59',$timestamp);
return $ret;
}
function getHourRange($date){
$ret=array();
$timestamp=strtotime($date);
$ret['sdate']=date('Y-m-d H:00:00',$timestamp);
$ret['edate']=date('Y-m-d H:59:59',$timestamp);
return $ret;
}
function getHourRange($date){
$ret=array();
$timestamp=strtotime($date);
$ret['sdate']=date('Y-m-d 00:00:00',$timestamp);
$ret['edate']=date('Y-m-d 23:59:59',$timestamp);
return $ret;
}
function getWeekRange($date){
$ret=array();
$timestamp=strtotime($date);
$w=date('w',$timestamp);
$w = $w==0 ? 7 : $w;
$ret['sdate']=date('Y-m-d 00:00:00',$timestamp-($w-1)*86400);
$ret['edate']=date('Y-m-d 23:59:59',$timestamp+(7-$w)*86400);
return $ret;
}
function getMonthRange($date){
$ret=array();
$timestamp=strtotime($date);
$mdays=date('t',$timestamp);
$ret['sdate']=date('Y-m-1 00:00:00',$timestamp);
$ret['edate']=date('Y-m-'.$mdays.' 23:59:59',$timestamp);
return $ret;
}