Customers who turn 18 | Community
Skip to main content
PietroAm1
Level 2
August 13, 2025
Solved

Customers who turn 18

  • August 13, 2025
  • 3 replies
  • 435 views

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

Best answer by SatheeskannaK

@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.

3 replies

SatheeskannaK
Community Advisor
Community Advisor
August 13, 2025

@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

Thanks, Sathees
PietroAm1
PietroAm1Author
Level 2
August 13, 2025

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

SatheeskannaK
Community Advisor
SatheeskannaKCommunity AdvisorAccepted solution
Community Advisor
August 13, 2025

@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
Mayank_Gandhi
Adobe Employee
Adobe Employee
August 13, 2025

@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.

 

PietroAm1
PietroAm1Author
Level 2
August 14, 2025

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.

 
Mayank_Gandhi
Adobe Employee
Adobe Employee
August 14, 2025

@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()))