RE: [PHP] getting number of days in agiven month
| From: | Jason Murray | Date: | Tue, 27 Mar 2001 00:53:21 +0000 |
| Subject: | RE: [PHP] getting number of days in agiven month | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45675@lists.php.net to get a copy of this message | ||
> Is there a way to find out the mumber of days of a given month? for
> example a function that I pass the month number i.e. 02 (February) and
> it returns 28?
Date("t", $unixtimestamp);
If you have a month "2", you need a year as well since February's days vary
according to the year, so:
$daysinmonth = Date("t", mktime(0, 0, 0, $month, 1, $year));
Jason