Expand my Community achievements bar.

Join us for the Community Q&A Coffee Break on May 2nd at 8 am PT with Adobe Journey Optimizer experts Robert Calangiu, Brent Kostak & Sandra Hausmann.
SOLVED

How to extract year from date in AJO using fx function?

Avatar

Level 1

We want to supply Year in Custom action from the field called registration Date which is in format "YYYY-MM-DD".
Inside AJO which fx function we should use to extract year from the same.

For example, RegistrationDate ="2022-07-08" , we want to use field as StartYear having value "2022".

Please assist.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@monika_26,

Try this: 

substr(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.person.RegistrationDate}),0,3)

Make sure you have the appropriate path for the registration date attribute.

Thanks, Sathees

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@monika_26,

Try this: 

substr(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.person.RegistrationDate}),0,3)

Make sure you have the appropriate path for the registration date attribute.

Thanks, Sathees

Avatar

Employee

This should be substr(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.person.RegistrationDate}),0,4)