您好,欢迎访问一九零五行业门户网

php 获取当月/某月最后一天的时间戳

public function getendmouthtime()
    {
        $date=date(y-m,time());
        $date_arr=explode('-',$date);
        $year=$date_arr[0];
        $month=$date_arr[1];
        $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($month 12)
        {
        return 0;
        }
// is the year a leap year?
        if ($month == 2)
        {
            if ($year%400 == 0 or ($year%4 == 0 and $year%100 != 0))
            {
            return $year.'-'.$month.'-29';
            }
        }
        return $endstro = strtotime($year.'-'.$month.'-'.$days_in_month[$month - 1]);
    }
其它类似信息

推荐信息