function date_minutes in Date 6
Same name and namespace in other branches
- 5.2 date_api.module \date_minutes()
- 6.2 date_api.module \date_minutes()
- 7.3 date_api/date_api.module \date_minutes()
- 7 date_api/date_api.module \date_minutes()
- 7.2 date_api/date_api.module \date_minutes()
An array of minutes.
Parameters
string $format:
$required: If not required, returned array will include a blank value.
Return value
an array of minutes in the selected format.
1 call to date_minutes()
- date_parts_element in ./
date_api_elements.inc - Create form elements for one or more date parts.
File
- ./
date_api.module, line 274 - This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.
Code
function date_minutes($format = 'i', $required = FALSE, $increment = 1) {
$minutes = array();
// Have to be sure $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;
}