You are here

function date_minutes in Date 7.2

Same name and namespace in other branches
  1. 5.2 date_api.module \date_minutes()
  2. 6.2 date_api.module \date_minutes()
  3. 6 date_api.module \date_minutes()
  4. 7.3 date_api/date_api.module \date_minutes()
  5. 7 date_api/date_api.module \date_minutes()

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.

Return value

array An array of minutes in the selected format.

2 calls to date_minutes()
date_is_all_day in date_api/date_api.module
Determine if a start/end date combination qualify as 'All day'.
date_parts_element in date_api/date_api_elements.inc
Creates form elements for one or more date parts.

File

date_api/date_api.module, line 1447
This module will make the date API available to other modules.

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;
}