首页 > php代码 > 日期所在月的天数

日期所在月的天数

<?php
public function daysOfMonth($year = NULL, $month = NULL) {
    if ($year === NULL) {
        $year = $this->getPart('yy');
    }
    if ($month === NULL) {
        $month = $this->getPart('mm');
    }
    if ($month == 2) {
        if (($year % 4 == 0 && $year % 100 != 0) || $year % 400 == 0) $result = 29;
        else $result = 28;
    } elseif ($month == 4 || $month == 6 || $month == 9 || $month == 11) $result = 30;
    else $result = 31;
    return $result;
}


教程链接:http://www.phprm.com/code/3b60b0b3ec1c11336bb2516bdd14f47a.html

随意转载~但请保留教程地址★

标签:none

发表留言