function date_iso_weeks_in_year in Date 6
Same name and namespace in other branches
- 8 date_api/date_api.module \date_iso_weeks_in_year()
- 5.2 date_api.module \date_iso_weeks_in_year()
- 6.2 date_api.module \date_iso_weeks_in_year()
- 7.3 date_api/date_api.module \date_iso_weeks_in_year()
- 7 date_api/date_api.module \date_iso_weeks_in_year()
- 7.2 date_api/date_api.module \date_iso_weeks_in_year()
Identify the number of ISO weeks in a year for a date.
December 28 is always in the last ISO week of the year.
Parameters
mixed $date:
string $type:
Return value
integer
1 call to date_iso_weeks_in_year()
- date_difference in ./
date_api.module - Compute difference between two days using a given measure.
File
- ./
date_api.module, line 662 - 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_iso_weeks_in_year($date = NULL, $type = DATE_OBJECT) {
if (empty($date)) {
$date = date_now();
$type = DATE_OBJECT;
}
$date = date_convert($date, $type, DATE_OBJECT);
if (is_object($date)) {
date_date_set($date, date_format($date, 'Y'), 12, 28);
return date_format($date, 'W');
}
return NULL;
}