note 97182 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Wed, 07 Apr 2010 13:31:18 +0000 |
| Subject: | note 97182 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167751@lists.php.net to get a copy of this message | ||
Note Submitter: searbe
----
You can use this with strtotime to get the number of days in a given month:
function daysInMonth($month, $year)
{
return date('d', strtotime(date('Y-m-01', strtotime($year . '-' .
$month . '-01 + 1 month')) . ' - 1 day'));
}
Add a month on to specified month, subtract a day to get to end of previous month, and return just
the day via date().