1 date.inc date_has_date($granularity)

Determines if the granularity contains a date portion.

Parameters

array $granularity: An array of allowed date parts, all others will be removed.

Return value

bool: TRUE if the granularity contains a date portion, FALSE otherwise.

File

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

Code

function date_has_date($granularity) {
  if (!is_array($granularity)) {
    $granularity = array();
  }
  $options = array('year', 'month', 'day');
  return (bool) count(array_intersect($granularity, $options));
}