Hi,
I have a time-sensitive request and would appreciate any quick guidance.
I’m trying to build an audience with a condition that checks if a user's start_date is before today and end_date is after today - essentially qualifying users who are currently active. However, I couldn’t find an option in the audience builder to compare dates directly against “today.”
Does anyone have recommendations on how to implement this?
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @trojan_horse ,
Use the Now token in the UI
Drag your start_date attribute onto the canvas.
Set the operator to is on or before and, in the date picker, choose Now (this represents the current timestamp).
Drag your end_date attribute onto the canvas.
Set the operator to is on or after and choose Now again.
Combine these with AND, and you’ve got exactly:
start_date <= Now
AND
end_date >= Now
This Now option is part of AEP’s time-constraint features in the Segment Builder UI
Use PQL in Code View
If you prefer to work in code or need to manage this programmatically, switch to Code view in the Segment Builder and you’ll see (or can edit) the equivalent Profile Query Language and add definition. You can then push this definition through the Segmentation API’s /audiences endpoint
Reference:
https://experienceleague.adobe.com/en/docs/platform-learn/tutorials/audiences/time-constraints
https://experienceleague.adobe.com/en/docs/experience-platform/segmentation/ui/segment-builder
Note: This response is inspired from Generative AI.
Thanks
Ankit
Hi @trojan_horse ,
Use the Now token in the UI
Drag your start_date attribute onto the canvas.
Set the operator to is on or before and, in the date picker, choose Now (this represents the current timestamp).
Drag your end_date attribute onto the canvas.
Set the operator to is on or after and choose Now again.
Combine these with AND, and you’ve got exactly:
start_date <= Now
AND
end_date >= Now
This Now option is part of AEP’s time-constraint features in the Segment Builder UI
Use PQL in Code View
If you prefer to work in code or need to manage this programmatically, switch to Code view in the Segment Builder and you’ll see (or can edit) the equivalent Profile Query Language and add definition. You can then push this definition through the Segmentation API’s /audiences endpoint
Reference:
https://experienceleague.adobe.com/en/docs/platform-learn/tutorials/audiences/time-constraints
https://experienceleague.adobe.com/en/docs/experience-platform/segmentation/ui/segment-builder
Note: This response is inspired from Generative AI.
Thanks
Ankit
@trojan_horse Just checking in — were you able to resolve your issue?
We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!
Views
Replies
Total Likes