note 97182 added to function.date
| From: | searbe at osu1 dot php dot net | Date: | Wed, 07 Apr 2010 12:02:17 +0000 |
| Subject: | note 97182 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167746@lists.php.net to get a copy of this message | ||
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().
----
Server IP: 69.147.83.197
Probable Submitter: 188.220.18.209
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/97182
Del: integrated -- https://master.php.net/note/delete/97182/integrated
Del: useless -- https://master.php.net/note/delete/97182/useless
Del: bad code -- https://master.php.net/note/delete/97182/bad+code
Del: spam -- https://master.php.net/note/delete/97182/spam
Del: non-english -- https://master.php.net/note/delete/97182/non-english
Del: in docs -- https://master.php.net/note/delete/97182/in+docs
Del: other reasons-- https://master.php.net/note/delete/97182
Reject -- https://master.php.net/note/reject/97182
Search -- https://master.php.net/manage/user-notes.php