1 date.inc date_minutes($format = 'i', $required = FALSE, $increment = 1)

Constructs an array of minutes.

Parameters

string $format: A date format string.

bool $required: (optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.

int $increment: (optional) The number by which the minutes should be incremented. Defaults to 1.

Return value

array: An array of minutes in the selected format.

File

core/includes/date.inc, line 342
Date API functions.

Code

function date_minutes($format = 'i', $required = FALSE, $increment = 1) {
  $minutes = array();
  // Ensure $increment has a value so we don't loop endlessly.
  if (empty($increment)) {
    $increment = 1;
  }
  for ($i = 0; $i < 60; $i += $increment) {
    $minutes[$i] = $i < 10 && $format == 'i' ? "0$i" : $i;
  }
  $none = array('' => '');
  return !$required ? $none + $minutes : $minutes;
}