note 16777 added to function.mcal-days-in-month
| From: | dash at dashonit dot com | Date: | Tue, 13 Nov 2001 06:49:47 +0000 |
| Subject: | note 16777 added to function.mcal-days-in-month | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20777@lists.php.net to get a copy of this message | ||
Returns number of days in a given month. Adjusts for leap year.
function determine_days_in_month($month, $year)
{
switch ($month)
{
case 1:
$numDays = 31;
break;
case 2:
// check to see if year is divisible by four
$leapyrchk = $year/4;
$leapyrchk = strlen($leapyrchk);
// if year is divisible by four, it will present a three-digit response
if($leapyrchk == 3)
{
// YES leapyear
$numDays = 29;
}
else
{
// NO leapyear
$numDays = 28;
}
break;
case 3:
$numDays = 31;
break;
case 4:
$numDays = 30;
break;
case 5:
$numDays = 31;
break;
case 6:
$numDays = 30;
break;
case 7:
$numDays = 31;
break;
case 8:
$numDays = 31;
break;
case 9:
$numDays = 30;
break;
case 10:
$numDays = 31;
break;
case 11:
$numDays = 30;
break;
case 12:
$numDays = 31;
break;
}
return $numDays;
}
--
http://www.php.net/manual/en/function.mcal-days-in-month.php
http://master.php.net/manage/user-notes.php?action=edit+16777
http://master.php.net/manage/user-notes.php?action=delete+16777
http://master.php.net/manage/user-notes.php?action=reject+16777