function date_has_date in Date 7.3
Same name and namespace in other branches
- 5.2 date_api.module \date_has_date()
- 6.2 date_api.module \date_has_date()
- 7 date_api/date_api.module \date_has_date()
- 7.2 date_api/date_api.module \date_has_date()
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.
1 call to date_has_date()
- 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 2297 - This module will make the date API available to other modules.
Code
function date_has_date(array $granularity) {
if (!is_array($granularity)) {
$granularity = array();
}
$options = array(
'year',
'month',
'day',
);
return (bool) count(array_intersect($granularity, $options));
}