How to calculate age?

I need to read date of birth from excel sheet and calculate the age and write the age to the excel sheet. How that can be done in UiPath? Can somone help me

Hi @sonia_thomas

You can use the DateDiff method available from the DateTime class.

  1. Get the DateDiff between date of birth and today’s date.
  2. Use the DateInterval.Year to get the difference in years.
3 Likes

Hello!

You can use the DateDiff function.

Example:

Syntax: DateDiff(DateInterval, Date1,Date2)
Code: DateDiff(DateInterval.Day, β€œ2016-01-30”,β€œ2016-01-30”)

It will return the number of the days between the two dates as Integer Type.

Hope It helps!

Regards