You are here

function facetapi_get_date_gap in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 facetapi.date.inc \facetapi_get_date_gap()
  2. 7 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.

Return value

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

facetapi_get_timestamp_gap()

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 147
Date handling functions.

Code

function facetapi_get_date_gap($start_date, $end_date) {
  $range = array(
    strtotime($start_date),
    strtotime($end_date),
  );
  if (!in_array(FALSE, $range, TRUE)) {
    return facetapi_get_timestamp_gap($range[0], $range[1]);
  }
  return FALSE;
}