You are here

function date_weeks_in_year in Date 6.2

Same name and namespace in other branches
  1. 8 date_api/date_api.module \date_weeks_in_year()
  2. 5.2 date_api.module \date_weeks_in_year()
  3. 6 date_api.module \date_weeks_in_year()
  4. 7.3 date_api/date_api.module \date_weeks_in_year()
  5. 7 date_api/date_api.module \date_weeks_in_year()
  6. 7.2 date_api/date_api.module \date_weeks_in_year()

The number of calendar weeks in a year.

PHP week functions return the ISO week, not the calendar week.

Parameters

int $year:

Return value

int number of calendar weeks in selected year.

File

./date_api.module, line 1177
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

Code

function date_weeks_in_year($year) {
  $date = date_make_date($year + 1 . '-01-01 12:00:00', 'UTC');
  date_modify($date, '-1 day');
  return date_week(date_format($date, 'Y-m-d'));
}