$tomorrow  = mktime(0,0,0,12,23,2002); //$start_date的时间戳
$tomorrow1 = mktime(0,0,0,3,15,2003); //$end_date的时间戳
计算出周的时间戳
月和季度的不好办,还没有想出来

解决方案 »

  1.   

    $d = (strtotime($end_date)-strtotime($start_date))/86400;
    echo "相差",$d,"天<br>";
    echo "相差",$d/7,"周<br>";
    echo "相差",$d/(365/12),"月<br>";
    echo "相差",$d/(365/4),"季<br>";
      

  2.   

    <?php
    $start = "2003-3-16";
    $end   = "2004-3-17";
    if(strtotime ($end) - strtotime ($start) <0 ) {
    echo("起始或者终日期不对!");
    exit();
    }
    $date = floor((strtotime ($end) - strtotime ($start))/86400);$week   = floor($date/7);
    $leavedate = $date - $week*7;$month  = floor($date/30);$season = floor($month/3);echo("两个日期之间的天数:".$date."<br>");
    echo("两个日期之间的星期数:".$week." 余:".$leavedate."天<br>");
    echo("两个日期之间的月数:".$month."<br>");
    echo("两个日期之间的季数:".$season."<br>");
    ?>临时写的,可能这样计算不够精确。我一个月是按照30天算的。如果这样不是你要的话。现在没时间,等会我再试试!
      

  3.   

    查阅php中的Calendar functions,你或许就会得到结果