龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

獲取本月天數(shù)

2023.10.17 | 661閱讀 | 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;

}


贊 (

發(fā)表評論