eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\DateMetadata::getNativeTime PHP Method

getNativeTime() protected method

Map value to a proper Elasticsearch date representation.
protected getNativeTime ( mixed $value ) : string
$value mixed
return string
    protected function getNativeTime($value)
    {
        if (is_numeric($value)) {
            $date = new DateTime("@{$value}");
        } else {
            try {
                $date = new DateTime($value);
            } catch (Exception $e) {
                throw new InvalidArgumentException('Invalid date provided: ' . $value);
            }
        }
        return $date->format('Y-m-d\\TH:i:s\\Z');
    }
DateMetadata