Seeking help to calculate a person’s age from their birthdate using UiPath

I am trying to calculate age from a given date of birth in UiPath. I want to know the most efficient way to do this, either using built-in activities or expressions. Any examples or workflows would be helpful.” If you want, I can also draft the full post ready to copy-paste for the forum with proper formatting and code snippet placeholders. Do you want me to do that?

Hey @james365
you can use this expression:

(DateTime.Today.Year - dateOfBirth.Year) -
      If(DateTime.Today < dateOfBirth.AddYears(DateTime.Today.Year - dateOfBirth.Year), 1, 0)

Hi @james365

There are various ways to do this. Also depends if it’s just one value or you are reading data from excel or some other input source.

main steps would be to read the birthdate of person, calculate the difference between now and the birthdate and the convert that into years.

I am attaching few posts here that have different ways to do the same, please refer

Hope this helps.