Skip to main content
Level 2
August 7, 2023
Solved

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

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.

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
August 7, 2023

@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

2 replies

SatheeskannaK
Adobe Champion, Community Advisor, UG Leader
SatheeskannaKAdobe Champion, Community Advisor, UG LeaderAccepted solution
Adobe Champion, Community Advisor, UG Leader
August 7, 2023

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

Translate
Thanks, Sathees
Mohan_Dugganab
Adobe Employee
Adobe Employee
November 27, 2023

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

Translate