function DateOut($y,$m) {
return date("Y-m-t", strtotime("$y-$m"));
}

解决方案 »

  1.   

    function dateout($year,$month){
    return date('Y-m-d',strtotime('-1 day',strtotime('next month',mktime(0,0,0,$month,1,$year))));
    }
      

  2.   

    月末日期就是下个月第一天的前一天,就是下个月第0天,即年份不变,月份加1,日期为0function DateOut($y,$m){
    return date("Y-m-d",mktime(0,0,0,$m+1,0,$year));
    }
      

  3.   


    function DateOut($year,$month){
    return date("Y-m-d",mktime(0,0,0,$month+1,0,$year));
    }
    echo DateOut(2000,3)."<br />";
    echo DateOut(2007,2)."<br />";
    echo DateOut(2008,2)."<br />";
    exit;结果:
    2000-03-31
    2007-02-28
    2008-02-29