note 26773 deleted from ref.calendar by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 01:53:11 +0000 |
| Subject: | note 26773 deleted from ref.calendar by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141918@lists.php.net to get a copy of this message | ||
Note Submitter: dy64 at dy64 dot de
----
Best performance:
/*
* Find the number of days in a month
* Year is between 1 and 32767 inclusive
* Month is between 1 and 12 inclusive
*/
function DayInMonth($month, $year) {
var $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($month != 2) return $daysInMonth[$month - 1];
return (checkdate($month, 29, $year)) ? 29 : 28;
}