You are here

function facetapi_format_date in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 facetapi.date.inc \facetapi_format_date()
  2. 7 facetapi.date.inc \facetapi_format_date()

Returns a formatted date based on the passed ISO date string and gap.

Parameters

$date: A string containing the date as an ISO date string.

$gap: A string containing the gap, see FACETAPI_DATE_* constants for valid values, defaults to YEAR.

$callback: The formatting callback, defaults to "facetapi_format_timestamp".

Return value

A gap-appropriate display date used in the facet link.

See also

facetapi_format_timestamp()

1 call to facetapi_format_date()
facetapi_map_date in ./facetapi.callbacks.inc
Maps date ranges to human readable dates.

File

./facetapi.date.inc, line 229
Date handling functions.

Code

function facetapi_format_date($date, $gap = FACETAPI_DATE_YEAR, $callback = 'facetapi_format_timestamp') {
  $timestamp = strtotime($date);
  return $callback($timestamp, $gap);
}