You are here

function date_calc_quarter_of_year in Date 6.2

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

Returns quarter of the year for given date.

Parameters

int $day: The day of the month.

int $month: The month.

int $year:

Return value

int The number of the quarter in the year.

File

date_php4/date_php4_calc.inc, line 637

Code

function date_calc_quarter_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();
  }
  $year_quarter = intval(($month - 1) / 3 + 1);
  return $year_quarter;
}