# SOLVED: ACF Meta Query Date between two fields

**URL:** <https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570>\
**Category:** How To\
**Tags:** how-to\
**Created:** [May 28, 2023, 11:19pm UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570 "2023-05-28T23:19:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [May 28, 2023, 11:19pm UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/1 "2023-05-28T23:19:30Z")

</div>

I am trying to use a Meta Query to show a card in a loop only if the current date is on or between two date fields. I am trying to use the “And” as that seems to make the most sense but only one or the other is working to limit the results.

I have tried several combinations of criteria but so far either I am missing something simple, maybe Bricks standard Meta Queries don’t work this way, or I need to leverage an external custom Meta Query definition.

- Am I declaring this correctly?
- Am I asking Bricks to do something it can’t do natively?
- Do I need to create and use an external Meta Query?

I saw this post [https://forum.bricksbuilder.io/t/solved-post-loop-meta-query-by-acf-date-field/2309/6](https://forum.bricksbuilder.io/t/solved-post-loop-meta-query-by-acf-date-field/2309/6) but I want to use dates between two date fields so that the client can set the start date to show the event banner before the actual start date and then it stops presenting after the end date is reached, without having to go back to the post to turn it on and off for presenting.

If the latter, what are all the steps to use an external query?

I use WPcodebox for my external / include code functionality.

This screenshot show’s my latest attempt:

 ![screen-cap-1](https://forum.bricksbuilder.io/uploads/default/original/2X/5/5290fdc6de462b05fab635659596fba68a20754d.png)

---

<div class="post-metadata">

**Author:** ![aslotta](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/aslotta/32/5419_2.png) [@aslotta](https://forum.bricksbuilder.io/u/aslotta)\
**Post date:** [May 29, 2023, 6:31am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/2 "2023-05-29T06:31:36Z")

</div>

Hey John,

this is natively possible as long as you make sure that you always have both custom fields (start date and end date) available. If there are cases where there is only a start date but no end date you’d need to use the [query\_vars](https://academy.bricksbuilder.io/article/filter-bricks-posts-query_vars/) hook as it is not possible to create nested meta queries using the query loop builder at the moment.

In your latest attempt screenshot you are checking if the announcement’s end date is before the current date. Which is probably not what you want. You want to make sure that the start date is before (less than or equal) the current date and the end date is after (greater than or equal) the current date.

So if these are our custom event fields…

 ![CleanShot 2023-05-29 at 08.26.52@2x](https://forum.bricksbuilder.io/uploads/default/original/2X/f/f0c5e5650a8f68b84bd430e1456227fcebd92340.png)

… you’d nee the following meta query:

 ![CleanShot 2023-05-29 at 08.27.36@2x](https://forum.bricksbuilder.io/uploads/default/original/2X/3/3c24e729adbf9bd559418140b4eee56c6d56cf00.png)

Best,

André

---

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [May 29, 2023, 9:35am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/3 "2023-05-29T09:35:04Z")

</div>

Andre,

Thank you sincerely for your time and assistance.

It looks like my logic is working now. I will do some other tests but looking good so far.

Kind regards,

-John

---

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [September 12, 2023, 5:39am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/4 "2023-09-12T05:39:42Z")

</div>

Feels like this stopped working in Bricks 1.9

 ![meta-query-date-2](https://forum.bricksbuilder.io/uploads/default/original/2X/9/9fe2c786bee7b1fb3d0863b87018d7a8a92a8271.png)

Now nothing is returned.

I sent creds and a reference to “help”. account

Thanks

---

<div class="post-metadata">

**Author:** ![itchycode](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/itchycode/32/4542_2.png) [@itchycode](https://forum.bricksbuilder.io/u/itchycode)\
**Post date:** [September 13, 2023, 2:16am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/5 "2023-09-13T02:16:15Z")

</div>

Hi @jmcbade ,

As per my email reply, just set the Type to DATE or DATETIME

Regards,  
Jenn

---

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [September 13, 2023, 9:07am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/6 "2023-09-13T09:07:25Z")

</div>

Did not solve.

Have you looked at the sandbox site?

---

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [September 18, 2023, 2:32am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/7 "2023-09-18T02:32:28Z")

</div>

This issue is not solved for me yet. I created a sandbox in hopes of understanding a resolution.

May I please have some more help on this?

---

<div class="post-metadata">

**Author:** ![itchycode](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/itchycode/32/4542_2.png) [@itchycode](https://forum.bricksbuilder.io/u/itchycode)\
**Post date:** [September 18, 2023, 3:19am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/8 "2023-09-18T03:19:09Z")

</div>

hi @jmcbade

I did another email reply 5 days ago to check what is the expected result.  
Anyway, let’s continue our conversation here.

This was the reply

============

 ![image](https://forum.bricksbuilder.io/uploads/default/original/2X/9/9436b9d3e6599f015b9c1f2be2f6b817411ec6e4.jpeg)

===========

Basically it was only 1 event met your condition on 13 September

Now if you look at your site should be empty as today is 18 September and no single event should show. Please tweak any of your event post type end date to check the result.

Regards,  
Jenn

---

<div class="post-metadata">

**Author:** ![jmcbade](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jmcbade/32/3375_2.png) [@jmcbade](https://forum.bricksbuilder.io/u/jmcbade)\
**Post date:** [September 18, 2023, 4:28am UTC](https://forum.bricksbuilder.io/t/solved-acf-meta-query-date-between-two-fields/12570/9 "2023-09-18T04:28:34Z")

</div>

“Basically it was only 1 event met your condition on 13 September”

Ok, yeah. I _ **think** _ it’s is now working as expected. 🤪

Thanks
