1 date.inc | date_has_time($granularity) |
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.
File
- core/
includes/ date.inc, line 1100 - Date API functions.
Code
function date_has_time($granularity) {
if (!is_array($granularity)) {
$granularity = array();
}
$options = array('hour', 'minute', 'second');
return (bool) count(array_intersect($granularity, $options));
}