function days_in_month($month, $year) { // calculate number of days in a month return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31); } echo days_in_month(2,2014);
输出:28
转自:http://www.cnblogs.com/freespider/p/3545885.html
时间: 2024-10-13 20:45:25