Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

adilk1
adilk1
Offline

Badges

Badges
4

Accepted Solutions

Accepted Solutions
1

Likes Received

Likes Received
2

Posts

Posts
2

Discussions

Discussions
0

Questions

Questions
2

Ideas

Ideas
0

Blog Posts

Blog Posts
0
Top badges earned by adilk1
Customize the badges you want to showcase on your profile
Re: Custom JS to extract YYYY from a data element text an... - Adobe Experience Platform Data Collection 11-07-2020
var x=_satellite.getVar('dataLayer var: DOB'); var dobYear = x.getFullYear(); var curYear = new Date().getFullYear(); var age = curYear - dobYear; return age; Answer above.

Views

361

Likes

2

Replies

1
Custom JS to extract YYYY from a data element text and subtract from current year to find out age in years - Adobe Experience Platform Data Collection 07-07-2020
Hello,I have a data element that is currently picking up values such as this:Tue Oct 07 1975 00:00:00 GMT+0400 (Gulf Standard Time)Tue May 05 1981 00:00:00 GMT+0400 (Gulf Standard Time) I'd like to extract the YYYY [Char 11 - 15] from the text and then subtract from current year 2020 to get the age of the user. How can I accomplish this?Output required:Case 1: 45 ... [2020 - 1975]Case 2: 39 ...[2020 - 1981] --Edit: This is what I have so far but it doesn't load the data element.QB: DOB is for ex...

Views

389

Likes

0

Replies

2
Likes from