取数据 从数据库中取上周的数据,也就是本周取上一周的,下周取本周的,怎么取啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?phpfunction getLastWeekDate($date){ $iDate = strtotime($date); $iLastDate = $iDate-7*24*60*60; if(date('w',$iLastDate) == 0){ //周日 $sLastWeekStart = date('Y-m-d 00:00:00',$iLastDate-7*24*60*60); $sLastWeekEnd = date('Y-m-d 23:59:59',$iLastDate); }else{ //非周日 $sLastWeekStart = date('Y-m-d 00:00:00',$iLastDate-date('w',$iLastDate)*24*60*60); $sLastWeekEnd = date('Y-m-d 23:59:59',$iLastDate+(7-date('w',$iLastDate))*24*60*60); } return array('start_time'=>$sLastWeekStart,'end_time'=>$sLastWeekEnd);}$arrDate = getLastWeekDate('2011-07-11 12:00:00');var_dump($arrDate);?> zend studio for eclipse 6.0 中怎么配置服务器APACHE和数据库MYSQL count(*)的奇怪问题 类的__get()和__set()问题请教 关于PHP5的配置问题 求解答 问个dedecms的问题 php连接oracle出错 "TNS: 协议适配器错误" ?比如有个表叫table ,有id,name 字段,怎么把这个两个字段放入1个2维数组,(cdm11cn) 在php中,.tpl文件是做什么用的?? 在Apache里怎样设置虚拟路径,就象IIS里的虚拟目录一样? php,数组拷贝 wince 窗体全屏显示问题
function getLastWeekDate($date){
$iDate = strtotime($date);
$iLastDate = $iDate-7*24*60*60;
if(date('w',$iLastDate) == 0){ //周日
$sLastWeekStart = date('Y-m-d 00:00:00',$iLastDate-7*24*60*60);
$sLastWeekEnd = date('Y-m-d 23:59:59',$iLastDate);
}else{ //非周日
$sLastWeekStart = date('Y-m-d 00:00:00',$iLastDate-date('w',$iLastDate)*24*60*60);
$sLastWeekEnd = date('Y-m-d 23:59:59',$iLastDate+(7-date('w',$iLastDate))*24*60*60);
}
return array('start_time'=>$sLastWeekStart,'end_time'=>$sLastWeekEnd);
}$arrDate = getLastWeekDate('2011-07-11 12:00:00');
var_dump($arrDate);
?>