function date_has_time in Date 7.2
Same name and namespace in other branches
- 5.2 date_api.module \date_has_time()
- 5 date.inc \date_has_time()
- 6.2 date_api.module \date_has_time()
- 6 date_api.module \date_has_time()
- 7.3 date_api/date_api.module \date_has_time()
- 7 date_api/date_api.module \date_has_time()
Determines if the granularity contains a time portion.
Parameters
array $granularity: An array of allowed date parts, all others will be removed.
Return value
bool TRUE if the granularity contains a time portion, FALSE otherwise.
13 calls to date_has_time()
- date_all_day_date_field_widget_settings_form_alter in date_all_day/
date_all_day.module - Implements hook_date_field_widget_settings_form_alter().
- date_all_day_field in date_all_day/
date_all_day.module - Determine if a Start/End date combination qualify as 'All day'.
- date_combo_validate in ./
date_elements.inc - Validate and update a combo element.
- date_field_all_day in ./
date.module - Duplicate of what is now date_all_day_field() in the Date All Day module.
- date_limit_format in date_api/
date_api.module - Limits a date format to include only elements from a given granularity array.
File
- date_api/
date_api.module, line 2280 - This module will make the date API available to other modules.
Code
function date_has_time(array $granularity) {
if (!is_array($granularity)) {
$granularity = array();
}
$options = array(
'hour',
'minute',
'second',
);
return (bool) count(array_intersect($granularity, $options));
}