Skip to main content
PietroAm1
Level 2
Aug 13, 2025 8:57 AM UTC
Solved

Customers who turn 18

Hi, I need to identify customers who turn 18 today from the birth date with an fx. How can I do it?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SatheeskannaK
SatheeskannaKAccepted solution
Adobe Champion, Community Advisor, UG Leader
Aug 13, 2025 4:47 PM UTC

@pietroam1 Unfortunately, there isn't a function available to determine the age; instead, you'll need to utilize an expression similar to what Mohan mentioned. Another option would be to use a computed attribute.

Thanks, Sathees

7 replies

SatheeskannaK
Adobe Champion, Community Advisor, UG Leader
Adobe Champion, Community Advisor, UG Leader
Aug 13, 2025 1:30 PM UTC

@pietroam1 Use the computed attributes to calculate the age and use that field in the audience definition.

https://experienceleague.adobe.com/en/docs/experience-platform/profile/computed-attributes/overview

Translate
Thanks, Sathees
PietroAm1
PietroAm1Author
Level 2
Aug 13, 2025 1:57 PM UTC

Pretty strange but we do not have this (and other functions) in AJO, that's why I've asked. I attach screenshot

Translate
SatheeskannaK
Adobe Champion, Community Advisor, UG Leader
SatheeskannaKAdobe Champion, Community Advisor, UG LeaderAccepted solution
Adobe Champion, Community Advisor, UG Leader
Aug 13, 2025 4:47 PM UTC

@pietroam1 Unfortunately, there isn't a function available to determine the age; instead, you'll need to utilize an expression similar to what Mohan mentioned. Another option would be to use a computed attribute.

Translate
Thanks, Sathees
Mayank_Gandhi
Adobe Employee
Adobe Employee
Aug 13, 2025 7:47 PM UTC

@pietroam1 Adobe Journey Optimizer provides Date functions, which you can use to manipulate and compare dates in your expressions, such as addYears, formatDate, and logical comparison operators.
here is what you can try: 

if your birth date field is profile.person.birthDate, the expression in the audience rule or decision block would look like:


{{formatDate addYears profile.person.birthDate 18 "yyyy-MM-dd"}} == {{formatDate now "yyyy-MM-dd"}}

This logic checks if today's date (formatted as yyyy-MM-dd) matches the birth date plus 18 years (also formatted as yyyy-MM-dd). You may want to adapt the field name based on your profile schema.

 

Translate
PietroAm1
PietroAm1Author
Level 2
Aug 14, 2025 6:36 AM UTC

Thnaks, just tried with expression below, swapping my schema's field

 

{{formatDate addYears #{ExperiencePlatform.ProfileFieldGroup.profile._cagroupit.anagraficaCliente.DATA_NASCITA} 18 "YYYY-MM-DD"}} == {{formatDate now "yyyy-MM-dd"}}

 

it returns error

 

The expression is invalid : Unexpected character '{' . Please, check that it is a valid token and that you are using it at the right place.

 
Translate
Mayank_Gandhi
Adobe Employee
Adobe Employee
Aug 14, 2025 10:55 AM UTC

@pietroam1  try

let dob          = #{ExperiencePlatform.ProfileFieldGroup.profile._cagroupit.anagraficaCliente.DATA_NASCITA};
let eighteenth   = date(getYear(dob)+18 ,   /* year  */
                       getMonth(dob)  ,   /* month */
                       getDayOfMonth(dob) /* day   */);

/* Compare to today */
(eighteenth == toDateOnly(now()))
Translate