1.20.x date.inc | date_days_in_month($year, $month) |
Identifies the number of days in a month for a date.
File
- includes/
date.inc, line 819 - Date API functions and constants.
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');
}