<p>The special strings <code>:empty:</code> and <code>:notempty:</code> might be what you're looking for. The docs list it only against expiryDate, but I think it's available for any field: <a href="https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#expirydate" rel="nofollow noreferrer">https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#expirydate</a></p>

CC BY-SA 4.0
2020-06-24T15:45:04.910Z
2020-06-24T15:45:04.910Z
James Smith
<p>I have date field in entry that is empty therefore has <code>null</code> value.
I'd like to filter entries that have <code>date</code> field value equal to <code>null</code>.</p>
<p>How would I set that parameter on element criteria object? I don't want to achieve it by looping yet because I'm merging entries from another section.</p>
<hr />
<p>Setting it to <code>null</code> returns entries with or without value.</p>
<pre><code>{% set myEntries = craft.entries.section(&quot;mySection&quot;).date(null) %}
</code></pre>
<p>Setting it to <code>&quot;&quot;</code> returns entries with or without value.</p>
<pre><code>{% set myEntries = craft.entries.section(&quot;mySection&quot;).date(&quot;&quot;) %}
</code></pre>

<datetime><craft2>
How to filter entries with null value in date field?
# How to filter entries with null value in date field?

(Asked by: username_0 on 2020-06-24)

I have date field in entry that is empty therefore has null value.
I'd like to filter entries that have date field value equal to null.
How would I set that parameter on element criteria object? I don't want to achieve it by looping yet because I'm merging entries from another section.

Setting it to null returns entries with or without value.
{% set myEntries = craft.entries.section("mySection").date(null) %}

Setting it to "" returns entries with or without value.
{% set myEntries = craft.entries.section("mySection").date("") %}

**Tags:** datetime, craft2

---

## 1 answers

### Answer by username_1 on 2020-06-24. Score: 3 | Accepted answer

The special strings `:empty:` and `:notempty:` might be what you're looking for. The docs list it only against expiryDate, but I think it's available for any field: <https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html#expirydate>


---

