Determining number of days in a selected month
| From: | Ben Miller | Date: | Fri, 20 Jan 2006 05:39:53 +0000 |
| Subject: | Determining number of days in a selected month | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-228912@lists.php.net to get a copy of this message | ||
Is there a way to easily tell PHP how many days there are in a selected
month without writing the following out for each month:
if($Month == "January") {
$NumberOfDays = 31;
}
elseif($Month == "February") {
if($Year == "A Leap Year") {
$NumberOfDays = 29;
}
elseif($Year != "A Leap Year") {
$NumberOfDays = 28;
}
}
elseif($Month == "March") {
$NumberOfDays = 31;
}
............and so on, and so on, and so on
I would greatly appreciate any help. Thanks.