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
You can use the DateDiff method available from the DateTime class.
- Get the DateDiff between date of birth and today’s date.
- Use the DateInterval.Year to get the difference in years.
You can use the DateDiff function.
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!
In this video I do a lot of stuff with DateTime:
In your case, you can do the difference between YEARS after you convert from String to DateTime, or you can use TimeSpan from here(TimeSpan Struct (System) | Microsoft Docs)
UiPath Tutorial for String and DateTime (Use-cases) - YouTube
20:05 DateTime to string in multiple ways
23:00 AddDays get DayofWeek
25:40 Convert from String to DateTime
26:20 Compare DateTime