Calculating age from 2 dates

Hi,

My form collects the person’s date of birth (via the calendar dropdown).  The next field along wants the person’s current age.  This can be calculated by subtracting d.o.b. from today’s date.   In fact you have a default value of [date] which should return today’s date.

However, when I subtract the one from the other I get a ridiculous negative number.  it doesn’t seem to be numbers of days or years.  what is it and how can I get a decimalised age?  (ie: 35.4).

thanks,

John.

There are a couple of options. If you are only needing to show the age somewhere, you can do this in a custom display with [25 time_ago=1]

If you want a field in your form to hold the age, you can use built-in calculations. It would only be calculated when the form is submitted.
You'll need 1 date field for DOB, and 1 date field set to "admin only" with the dynamic default value [date], and one field for the age.
For the age, I used the calculation: ([date-field]-[dob-field])/365.25

Thanks Stephanie. This is a huge  help.

Topic closed.