note 113539 added to function.cal-days-in-month
| From: | p2409 at hotmail dot com | Date: | Mon, 28 Oct 2013 05:09:47 +0000 |
| Subject: | note 113539 added to function.cal-days-in-month | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197332@lists.php.net to get a copy of this message | ||
If you have a DateTime variable you want to find the number of days in the month for, you can simply
use $dt->format and the format specifiers 'm' and 'Y' to get the month digit,
and year to use with cal_days_in_month eg.
function DaysInMonth($dt) {
$m = $dt->format('m');
$y = $dt->format('Y');
$numDays = cal_days_in_month (CAL_GREGORIAN, $m,$y);
return $numDays;
}
----
Server IP: 187.73.33.55
Probable Submitter: 120.148.0.138
----
Manual Page -- http://php.net/manual/en/function.cal-days-in-month.php
Edit -- https://master.php.net/note/edit/113539
Del: integrated -- https://master.php.net/note/delete/113539/integrated
Del: useless -- https://master.php.net/note/delete/113539/useless
Del: bad code -- https://master.php.net/note/delete/113539/bad+code
Del: spam -- https://master.php.net/note/delete/113539/spam
Del: non-english -- https://master.php.net/note/delete/113539/non-english
Del: in docs -- https://master.php.net/note/delete/113539/in+docs
Del: other reasons-- https://master.php.net/note/delete/113539
Reject -- https://master.php.net/note/reject/113539
Search -- https://master.php.net/manage/user-notes.php