1 date.inc | date_days_in_month($year, $month) |
Identifies the number of days in a month for a date.
File
- core/
includes/ date.inc, line 821 - Date API functions.
Code
function date_days_in_month($year, $month) {
// Pick a day in the middle of the month to avoid timezone shifts.
$datetime = date_pad($year, 4) . '-' . date_pad($month) . '-15 00:00:00';
$date = new BackdropDateTime($datetime);
return $date->format('t');
}