You are here

function date_calc_get_calendar_week in Date 6.2

Same name and namespace in other branches
  1. 5.2 date_php4/date_php4_calc.inc \date_calc_get_calendar_week()
  2. 6 date_php4/date_php4_calc.inc \date_calc_get_calendar_week()

Return an array with days in 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.

string $format: The string indicating how to format the output.

Return value

array $week[$weekday].

File

date_php4/date_php4_calc.inc, line 740

Code

function date_calc_get_calendar_week($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) {
  if (empty($year)) {
    $year = date_calc_get_year();
  }
  if (empty($month)) {
    $month = date_calc_get_month();
  }
  if (empty($day)) {
    $day = date_calc_get_day();
  }
  $week_array = array();

  // date for the column of week
  $curr_day = date_calc_begin_of_week($day, $month, $year, '%E');
  for ($counter = 0; $counter <= 6; $counter++) {
    $week_array[$counter] = date_calc_days_to_date($curr_day, $format);
    $curr_day++;
  }
  return $week_array;
}