Expand my Community achievements bar.

Dive in, experiment, and see how our AI Assistant Content Accelerator can transform your workflows with personalized, efficient content solutions through our newly designed playground experience.
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)