You are here

function date_has_time in Date 7.3

Same name and namespace in other branches
  1. 5.2 date_api.module \date_has_time()
  2. 5 date.inc \date_has_time()
  3. 6.2 date_api.module \date_has_time()
  4. 6 date_api.module \date_has_time()
  5. 7 date_api/date_api.module \date_has_time()
  6. 7.2 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.

11 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_combo_validate in ./date_elements.inc
Validate and update a combo element.
date_limit_format in date_api/date_api.module
Limits a date format to include only elements from a given granularity array.
date_parts_element in date_api/date_api_elements.inc
Creates form elements for one or more date parts.
date_popup_element_value_callback in date_popup/date_popup.module
Element value callback for date_popup element.

... See full list

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