龙岩易富通网络科技有限公司

龙岩小程序开发,龙岩分销系统

获取本月天数

2023.10.17 | 346阅读 | 0条评论 | php

/**

 * 

 * @param string $date  格式2023-05

 * @return number

 */

function get_day($date) {

$tem = explode ( '-', $date );

$year = $tem ['0'];

$month = $tem ['1'];

if (in_array ( $month, array (1,3,5,7,8,01,03,05,07,08,10,12 ) )) {

$day = 31;

} elseif ($month == 2) {

if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 !== 0)) {

$day = 29;

} else {

$day = 28;

}

} else {

$day = 30;

}

return $day;

}


赞 (

发表评论