Not able to display the age of employees

Hi team,

I am working on acme UiPath test where in I need to display the employee age older than 35.
I have used the condition in if activity


And date of birth is the output of get text …
When I run it’s nt displaying anything it’s just executing successful without any error.

Can u plz this.

HI @Bhagyashree_S

It is working for me




For now, can you try the following expression?



Lets do it step by step:

When we do have strings, we would parse it into a datetime e.g.

Person is borned in Novemeber

So a year only calculation will bring a wrong result as 2023 - 2002 = 21
But the Person is still awaiting the birthday and today (10/20/2023) the age is 20

So we can do:

now.Year - Dob.Year - Convert.ToInt32( < new DateTime(now.Year, Dob.Month, Dob.Day))

And the condition looks like:


try this once


gives you the output as 1952
use assign activity and pass the below code


later use it if condition


Hi @Bhagyashree_S

Please find the below Solution.

AgeDetect.xaml (7.5 KB)

It’s showing as replacelineendings is not a member of string

It’s says document is invalid

Hi @Bhagyashree_S

Try this

CInt(Now.ToString("yyyy")) - CInt(dateofbirth.Split("/"c)(2)) > 35


CInt(DateTime.Now.ToString("yyyy")) - CInt(dateofbirth.Split("/"c)(2)) > 35

Hope this helps!!

For first code if have to display employees names along with age older than 35 …if I give < 35 then it’s not displaying anything.

Output of dateofbirth in gettect activity is 5/25/1993.

Here i have to display the employee age one by one which are older than 35.the dates are dynamic


Here i have to loop through all the employee names and get the details of age according to condition older than 35

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.