Calculate the age for leap year in Clarion 8

Hi

What is the embed formula to calculate the age of a person whos birthday is on the 29th February. With normal formula I get 20years old.

Kind regards

I don’t know that the 29th Feb would make any difference? Well apart from deciding if in non-leap years you advance their age on 28th Feb or 1st March.

what date were they born and what “normal formula” are you using? IOW please show your code.

We need specifics Bob

1 Like

that was hilarious Geoff B.

Tony, off the top of my head I think something simple like this will work

AgeInYears  long,auto
DateOfBirth long ! some clarion date

  code
  AgeInYears = year(today()) - year(DateOfBirth)
  if month(dateOfBirth) > month(today()) or |
    (month(dateOfBirth) = month(today()) and |
     day(dateOfBirth) > day(today()))
    AgeInYears -= 1
  end 

also see this earlier thread: