function date_calc_week_of_year in Date 6
Same name and namespace in other branches
- 5.2 date_php4/date_php4_calc.inc \date_calc_week_of_year()
- 6.2 date_php4/date_php4_calc.inc \date_calc_week_of_year()
Returns week of the year, first Sunday is first day of first week.
Parameters
int $day: The day of the month.
int $month: The month.
int $year: The 4 digit year. Do not add leading 0's for years prior to 1000.
Return value
int The number of the week in the year.
1 call to date_calc_week_of_year()
- date_calc_format in date_php4/
date_php4_calc.inc - Formats the date in the given format, much like strfmt()
File
- date_php4/
date_php4_calc.inc, line 609
Code
function date_calc_week_of_year($day = 0, $month = 0, $year = 0) {
if (empty($year)) {
$year = date_calc_get_year();
}
if (empty($month)) {
$month = date_calc_get_month();
}
if (empty($day)) {
$day = date_calc_get_day();
}
$iso = date_calc_gregorian_to_ISO($day, $month, $year);
$parts = explode('-', $iso);
$week_number = intval($parts[1]);
return $week_number;
}