Date Difference only in Years

Hi Team,

I want to calculate age of person only in years
For Example - if DOB is 20/04/2000 – Age = 21, if DOB is 20/05/2000 – Age = 20

Please suggest

Hi @Deeipauk,

int AgeDiff = now.Year - bday.Year

Regards,
Arivu

Thanks for your reply.
This will calculate only wit respect to year, if you check my example 20/05/2000 - Age = 20 but in this calculation it will come as 21 which is wrong

Hi,

can you try the following?

img20210427-5

Now.Year-dob.Year+Cint(Now.Month*100+Now.Day<dob.Month*100+dob.Day)

Sequence4.xaml (5.7 KB)

Regards,

1 Like

ok if you want the exact age
If (dob > Today.AddYears(-age)) Then age -= 1

Regards,
Arivu