日:$ago_day   = date('Y-m-d',time()-86400);

周:$age_week  = date('Y',time()-86400).date('W',time()-86400);

月:$ago_mouch = date('Y',time()-86400).date('m',time()-86400);


本周的起始时间和结束时间:

$flag = date("w");

  //echo $flag.'<br>';

  //echo date("U").'<br>'; 

 switch($flag)

 {

 case 0: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-13,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-7,date("Y"))); break; case 1: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-7,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-1,date("Y"))); break; case 2: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-8,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-2,date("Y"))); break; case 3: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-9,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-3,date("Y"))); break; case 4: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-10,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-4,date("Y"))); break; case 5: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-11,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-5,date("Y"))); break; case 6: $week_start = date("U",mktime(0,0,0,date("m"),date("d")-12,date("Y"))); $week_end = date("U",mktime(23,59,59,date("m"),date("d")-6,date("Y"))); break; 

 }


本月的起始和结束时间:

$y=date("Y",time());

$m=date("m",time());

$d=date("d",time());

$t0=date('t');           // 本月一共有几天

$week_start=mktime(0,0,0,$m,1,$y);        // 创建本月开始时间 

$week_end=mktime(23,59,59,$m,$t0,$y);       // 创建本月结束时间