function facetapi_get_date_gap in Facet API 7
Same name and namespace in other branches
- 6.3 facetapi.date.inc \facetapi_get_date_gap()
- 7.2 facetapi.date.inc \facetapi_get_date_gap()
Converts ISO date strings to Unix timestamps, passes values to the facetapi_get_timestamp_gap() function to calculate the gap.
Parameters
$start_date: A string containing the start date as an ISO date string.
$end_date: A string containing the end date as an ISO date string.
string|NULL $min_gap: (Optional) The minimum gap that should be returned.
Return value
string A string containing the gap, see FACETAPI_DATE_* constants for valid values. Returns FALSE of either of the dates cannot be converted to a timestamp.
See also
1 call to facetapi_get_date_gap()
- facetapi_map_date in ./
facetapi.callbacks.inc - Maps date ranges to human readable dates.
File
- ./
facetapi.date.inc, line 166 - Date handling functions.
Code
function facetapi_get_date_gap($start_date, $end_date, $min_gap = NULL) {
$range = array(
strtotime($start_date),
strtotime($end_date),
);
if (!in_array(FALSE, $range, TRUE)) {
return facetapi_get_timestamp_gap($range[0], $range[1], $min_gap);
}
return FALSE;
}