# DateTimeAttribute criterion

> For the complete documentation index, see [llms.txt](https://doc.ibexa.co/en/saas/llms.txt).

DateTimeAttribute Criterion

The `DateTimeAttribute Search Criterion` searches for products by value of a specified attribute, based on the [date and time attribute](https://doc.ibexa.co/en/saas/product_catalog/attributes/date_and_time/index.md) type.

## Arguments

- `identifier` - attribute's identifier (string)
- `value` - searched value ([DateTimeImmutable](https://www.php.net/manual/en/class.datetimeimmutable.php))

## Operators

The following operators are supported:

- FieldValueCriterion::COMPARISON_EQ
- FieldValueCriterion::COMPARISON_NEQ
- FieldValueCriterion::COMPARISON_LT
- FieldValueCriterion::COMPARISON_LTE
- FieldValueCriterion::COMPARISON_GT
- FieldValueCriterion::COMPARISON_GTE

## Example

### PHP

The following example lists all products for which the `event_date` attribute has value equal to 2025-07-06.

```php
<?php declare(strict_types=1);

use DateTimeImmutable;
use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion;
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
use Ibexa\Contracts\ProductCatalogDateTimeAttribute\Search\Criterion\DateTimeAttribute;

$query = new ProductQuery();
$filter = new DateTimeAttribute('event_date', new DateTimeImmutable('2025-07-06'));
$filter->setOperator(FieldValueCriterion::COMPARISON_EQ);
$query->setFilter($filter);
/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */
$results = $productService->findProducts($query);
```
