0

How can I calculate age at the time of an event in years?

I have the fields for Date of even and date of birth (DOB).  I would like to calculate the age using these and display it in years.  When i use the formula Date-DOB then the time elapsed displays in days.  I have tried to divide by 365 and it will display as the age by followed by days, minutes and seconds.  

Can anyone help me with this?

4 replies

null
    • Leonid_Semik
    • 6 yrs ago
    • Reported - view

    You can calculate the age with the following formula:

    ---

    age(DOB)

    ---

    regards

    Leo

    • Support
    • 6 yrs ago
    • Reported - view

    Or - if you have 2 date fields (Date and DOB):

    –––
    year('Date') - year('DOB') - if month('Date') < month('DOB') then
    1
    else
    if month('Date') = month('DOB') and day('Date') < day('DOB') then
    1
    else
    0
    end
    end + " year(s)"
    –––

    • jamesslatter
    • 3 yrs ago
    • Reported - view

    I find by doing that you get the age in years, but no decimal places 

    • Darrell_Baskin
    • 2 yrs ago
    • Reported - view

    I had the same problem and this is how I solved it: 

    field called OR Date = this was a date field for when patient had surgery (the event)

    field called DOB = this was a date field for their date of birth

    let elapsed := today() - 'OR Date';
    age(DOB + elapsed)

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 2835Views
  • 1 Following