Segment based on current Date AND Time

My Mautic version is: 3.1.2
My PHP version is: 7.3.24
My Database type and version is: 10.5.4-MariaDB
IIS 10.0

I was wondering if it is possible to create a segment based on the current Date AND Time. For example, if I have a campaign where I want to email someone when their subscription runs out. I don’t want to email them until it actually runs out, but would like to email them before the day is over.

The issue with using Today, is it just gives the current date without a time. So if I was to generate the segment when subscription end date = today, it would include people who don’t expire until later in the day. If I was to include subscription end date < today, people wouldn’t get added until tomorrow even if their accounts had already ended earlier today. Is there a build in feature like today that includes the time as well or would that be a feature request?

Basically if I was to re-generate the segments On March 1st at 4:00PM, I would like to be able to include anyone who’s subscription end date < March 1st, 4:00PM rather than < March 1st.

I couldn’t find a request to this feature, but if someone has already requested if someone could link me to it I could look at what would be required to create it.

Thanks,

It looks like this is the functionality implemented on this branch
Fix timezone issue segment rebuild by mohit-rocks · Pull Request #8652 · mautic/mautic · GitHub

I added the code locally and tested and it seems to be working as I was expecting above. It seems to have been requested to be merged on branch 3.3 but I don’t think it was included. Hopefully it will be on the next release and for now I’ll implement the changes locally.

We have the sprint for the 3.3.2 release tomorrow and Friday so if you can please leave a +1 to approve the PR (files changed > review changes > approve - and leave a note to say what you had before and what you have tested after applying the PR) then we can hopefully get it merged in 3.3.2!

I have approved and added my notes for the test. Thank you!

1 Like