note 127560 added to function.cal-days-in-month
| From: | datlx.yahoo.com via php-notes | Date: | Wed, 31 Aug 2022 15:59:57 +0000 |
| Subject: | note 127560 added to function.cal-days-in-month | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219501@lists.php.net to get a copy of this message | ||
function lastDayOfMonth(string $time, int $deltaMonth, string $format = 'Y-m-d')
{
try {
$year = date('Y', strtotime($time));
$month = date('m', strtotime($time));
$increaYear = floor(($deltaMonth + $month - 1) / 12);
$year += $increaYear;
$month = (($deltaMonth + $month) % 12) ?: 12;
$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
return $time . ' + ' . $deltaMonth . ' => ' . date($format,
strtotime($year . '-' . $month . '-' . $day)) . "\n";
} catch (Exception $e) {
throw $e;
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.173 (proxied: 42.113.143.168)
----
Manual Page -- https://php.net/manual/en/function.cal-days-in-month.php
Edit -- https://main.php.net/note/edit/127560
Del: integrated -- https://main.php.net/note/delete/127560/integrated
Del: useless -- https://main.php.net/note/delete/127560/useless
Del: bad code -- https://main.php.net/note/delete/127560/bad+code
Del: spam -- https://main.php.net/note/delete/127560/spam
Del: non-english -- https://main.php.net/note/delete/127560/non-english
Del: in docs -- https://main.php.net/note/delete/127560/in+docs
Del: other reasons-- https://main.php.net/note/delete/127560
Reject -- https://main.php.net/note/reject/127560
Search -- https://main.php.net/manage/user-notes.php