public function apachesolr_views_handler_filter_date::obtain_formated_date in Apache Solr Views 7
Obtains a formated data for SOLR.
Parameters
string $date_str: Date in string format.
string $round_string: String to add if no time is present.
Return value
string The date formated for SOLR.
1 call to apachesolr_views_handler_filter_date::obtain_formated_date()
- apachesolr_views_handler_filter_date::op_between in handlers/
apachesolr_views_handler_filter_date.inc - Filter for a date within certain range.
File
- handlers/
apachesolr_views_handler_filter_date.inc, line 141 - Date filter handler for Apache Solr Views.
Class
Code
public function obtain_formated_date($date_str, $round_string = '00:00:00') {
// Guess if we time part to the date and if not, add the round string.
if ($date_str != '' && !strpos($date_str, ':')) {
$date_str .= ' ' . $round_string;
}
$time = intval(strtotime($date_str));
if ($time != 0) {
$date = new DateObject($time);
$date_formatted = $date
->format(APACHESOLR_VIEWS_DATE_ISO8601);
}
else {
$date_formatted = '*';
}
return $date_formatted;
}