How to calculate age of the person based on dob(date and time) attribute

HOW TO CALCULATE AGE OF THE PERSON BASED ON DOB(DATE AND TIME) ATTRIBUTE USING LIST OPERATION?     for eg: I have List of employee data's, in that I have one attribute 'DOB'. so, based on DOB how to calculate employee age?   So that, I can easily delete employee details Age < 18. record must be deleted using list?    
4 answers

Hello Nirosha N,


What you can do this is create some logic with a variable with a cutoffdateofbirth, this variable you can define by the following:


addYears([%CurrentDateTime%], -18)


more about this function here


After you calculate this cutoff date you can retrieve the employees based on a xpath:


dateofbirth > cutofdateofbirth


Then you will get a list of all the employees that are younger than 18 and you can loop over this list to clean up the data


Hope this helps,


Good luck!


Hi Nirosha,

Maybe you Can use 


function, and calculate the years between the DOB and current date and then use it to check if it is bigger than 18 or not.


This will return you the number of years.

You can read more about this using this URL


Let me know, if you have any issues,

Hope it helps!


(Resilient It Services)


Screenshot 2024-07-03 151927.png


Check my flow is correct for delete the employee record if emp_age < 18 ? 


Note: here I'm not going to delete the record instead I'm just changing the attribute of is_delete = true.


I have one query I have two Attributes DOB(Date and Time) and Age(Integer) 


then How you'll calculate the age for integer data type?