How to extract year from date in AJO using fx function? | Community
Skip to main content
Level 2
August 7, 2023
Solved

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

  • August 7, 2023
  • 1 reply
  • 983 views

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.
Best answer by SatheeskannaK

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

1 reply

SatheeskannaK
Community Advisor
SatheeskannaKCommunity AdvisorAccepted solution
Community Advisor
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
Mohan_Dugganab
Adobe Employee
Adobe Employee
November 27, 2023

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