# Filter a segment dynamically, datetime field = now

**URL:** <https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025>\
**Category:** Product Support\
**Created:** [March 12, 2022, 4:05pm UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025 "2022-03-12T16:05:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [March 12, 2022, 4:05pm UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/1 "2022-03-12T16:05:02Z")

</div>

**Your software**  
My Mautic version is: 4.20  
My PHP version is: 7.4.28  
My Database type and version is: 10.3.34-MariaDB-log-cll-lve

**Your problem**  
My problem is:  
Im trying to filter a segment dynamically.

I have contacts with a DateTime field:

 ![contacts](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/7/7125726165e24d42f7e401a319cb1da35227d660.png)

I would like for the contacts to populate a segment depending on the DateTime field. So my filter looks like this:

 ![filter](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/7/7848d60dec27b1ebb83ed4c0dc532d5de709dc5f.png)

I read somewhere in the forum here that you can use ‘now’ to allow the filter to always have the correct date/time (maybe I misunderstood). But for the life of me, I cant get that to work.

If I enter ‘now’, the actual DateTime gets saved (and the filter works great but is ofc static).

I have tried =now, now() and so on, but I can’t get it to work.

Anyone that can point me in the right direction?

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [March 14, 2022, 6:41am UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/2 "2022-03-14T06:41:02Z")

</div>

Hello @CarlJohan,

What is your use case?

Pierre

---

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [March 14, 2022, 8:16am UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/3 "2022-03-14T08:16:45Z")

</div>

Hi @pierre_a , thanks for answering.

So, I have a list of recipients. Some of these recipients are in the US, some in Europe. I want to send the emails at the same time to all of them (let’s say noon). The easiest way would be to simply set a field in my original datasource with the time and date that the email should go out, and then when I import to Mautic, I have a field that is a datetime field that controls when the email will be sent.

It might sound complex, but it’s the workflow that I prefer.

I have solved this by writing a PHP script (triggered every 5 min with a cron), that updates the segment filter (basically sets the DateTime field to the current date and time), and that works great, but it’s a bit clumsy.

Any ideas on how to achieve this out of the box?

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [March 14, 2022, 9:50am UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/4 "2022-03-14T09:50:08Z")

</div>

Hello @CarlJohan,

You write " want to send the emails at the same time to all of them (let’s say noon)."

**Why it’s important for business?**

Pierre

---

<div class="post-metadata">

**Author:** ![CarlJohan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/carljohan/32/7016_2.png) [@CarlJohan](https://forum.mautic.org/u/CarlJohan)\
**Post date:** [March 14, 2022, 10:03am UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/5 "2022-03-14T10:03:26Z")

</div>

Request from client.

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [March 15, 2022, 5:08pm UTC](https://forum.mautic.org/t/filter-a-segment-dynamically-datetime-field-now/23025/6 "2022-03-15T17:08:29Z")

</div>

Hello @CarlJohan,

I understand that this is a customer request.  
I think the problem is taken the wrong way.  
If the business use case is not understandable by the community, it will be difficult to imagine the best solution 😉

It is already possible to choose a sending window with dates and times in Mautic.  
Potentially with one Mautic instance per country (or geographical area).  
Does this fulfill the need?

Pierre
