function date_iso_weeks_in_year in Date 7
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()
- 6 date_api.module \date_iso_weeks_in_year()
- 7.3 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:
Return value
integer
2 calls to date_iso_weeks_in_year()
- DateAPITestCase::testDateAPI in tests/
date_api.test - DateObject::difference in date_api/
date_api.module - Compute difference between two days using a given measure.
File
- date_api/
date_api.module, line 1368 - 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) {
if (empty($date)) {
$date = date_now();
}
elseif (!is_object($date)) {
$date = new DateObject($date);
}
if (is_object($date)) {
date_date_set($date, $date
->format('Y'), 12, 28);
return $date
->format('W');
}
return NULL;
}