1 date.inc | date_weeks_in_year($year) |
The number of calendar weeks in a year.
PHP week functions return the ISO week, not the calendar week.
Parameters
int $year: A year value.
Return value
int: Number of calendar weeks in selected year.
File
- core/
includes/ date.inc, line 1010 - Date API functions.
Code
function date_weeks_in_year($year) {
$date = new BackdropDateTime(($year + 1) . '-01-01 12:00:00', 'UTC');
date_modify($date, '-1 day');
return date_week($date->format('Y-m-d'));
}