本文整理匯總了PHP中Tx_Solr_Util::timestampToIso方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tx_Solr_Util::timestampToIso方法的具體用法?PHP Tx_Solr_Util::timestampToIso怎麽用?PHP Tx_Solr_Util::timestampToIso使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tx_Solr_Util
的用法示例。
在下文中一共展示了Tx_Solr_Util::timestampToIso方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: process
/**
* Expects a timestamp and converts it to an ISO 8601 date as needed by Solr.
*
* Example date output format: 1995-12-31T23:59:59Z
* The trailing "Z" designates UTC time and is mandatory
*
* @param array Array of values, an array because of multivalued fields
* @return array Modified array of values
*/
public function process(array $values)
{
$results = array();
foreach ($values as $timestamp) {
$results[] = Tx_Solr_Util::timestampToIso($timestamp);
}
return $results;
}
示例2: decodeFilter
/**
* Parses the given date range from a GET parameter and returns a Solr
* date range filter.
*
* @param string $rangeFilter The range filter query string from the query URL
* @param array $configuration Facet configuration
* @return string Lucene query language filter to be used for querying Solr
*/
public function decodeFilter($dateRange, array $configuration = array())
{
list($dateRangeStart, $dateRangeEnd) = explode(self::DELIMITER, $dateRange);
$dateRangeEnd .= '59';
// adding 59 seconds
// TODO for PHP 5.3 use date_parse_from_format() / date_create_from_format() / DateTime::createFromFormat()
$dateRangeFilter = '[' . Tx_Solr_Util::timestampToIso(strtotime($dateRangeStart));
$dateRangeFilter .= ' TO ';
$dateRangeFilter .= Tx_Solr_Util::timestampToIso(strtotime($dateRangeEnd)) . ']';
return $dateRangeFilter;
}