本文整理汇总了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;
}