PHP头条
热点:

PHP获取某个月的最大天数(最后一天)-PHP源码


PHP代码

//获取 某个月的最大天数(最后一天)
function getMonthLastDay($month, $year) {
    switch ($month) {
        case 4 :
        case 6 :
        case 9 :
        case 11 :
            $days = 30;
            break;
        case 2 :
            if ($year % 4 == 0) {
                if ($year % 100 == 0) {
                    $days = $year % 400 == 0 ? 29 : 28;
                } else {
                    $days = 29;
                }
            } else {
                $days = 28;
            }
            break;

        default :
            $days = 31;
            break;
    }
    return $days;
}

www.phpzy.comtrue/phpyy/44233.htmlTechArticlePHP获取某个月的最大天数(最后一天)-PHP源码 PHP代码 //获取 某个月的最大天数(最后一天)function getMonthLastDay($month, $year) { switch ($month) { case 4 : case 6 : case 9 : case 11 : $days = 30; break; c...

相关文章

PHP之友评论

今天推荐