1.20.x 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
- includes/
date.inc, line 1115 - Date API functions and constants.
Code
function date_has_date($granularity) {
if (!is_array($granularity)) {
$granularity = array();
}
$options = array('year', 'month', 'day');
return (bool) count(array_intersect($granularity, $options));
}