/** * Find the number of days in the given month * * @param int $month * the month, default is current local month * @param int $year * the year in four digit format, default is current local year * * @return int the number of days the month has * * @access public * @static * */ static function daysInMonth($month = 0, $year = 0) { if (empty($year)) { $year = Calc::dateNow('%Y'); } if (empty($month)) { $month = Calc::dateNow('%m'); } if ($year == 1582 && $month == 10) { return 21; // October 1582 only had 1st-4th and 15th-31st } if ($month == 2) { if (Calc::isLeapYear($year)) { return 29; } else { return 28; } } elseif ($month == 4 or $month == 6 or $month == 9 or $month == 11) { return 30; } else { return 31; } }