Hello GIS friends,
Hope you all are well.
I have a question. I'm trying to find an arcade expression or sql expression to substract Created_Date field from Current_Date field to get the Age. Is this something that is possible? I will really appreciate your input in helping me with the expression.
Thanks for the link but it only talks about the date/time expressions.
However, how do i get the calculated age to be displayed in the age field in field maps?
Should the data type of the age field be string or number or date even.
Advice from everyone is duly welcome.
Thank you for the direction. I tried this expression, but it did not run for me. I probably did not know how to insert the right fields in the expression. Here is the expression:
var startDate = Date($feature.startDateField); var endDate = Date($feature.endDateField); var age = DateDiff(endDate, startDate, 'years'); return age;
I only have created_date field and an Age field. I would like the derivation to populate the Age field by substracting current_date which I do not have from created_date.
I know this is an older post, but I was successfully able to use your expression to calculate the age in my own data. I seem to have better luck with Arcade when I enclose the field names in brackets and single quotes, but I also am using joined tables so that might be why. For example Date($feature['startDateField']).