Capturing age and/or birthdate efficiently

Hi all,

I would like to know how to handle cases where a precise birthdate isn’t known at all in a tracker registration form. (especially older people often don’t know their exact birthdates). If possible, I would like to capture an estimated age and then have a date of birth be calculated based on this.


Hello Davuya!

What I try to do to add a checkbox called “Date of birth is estimated”. That way, we know that the DoB is not accurate, and we record it in the same Attribute as the exact Date of birth.

Then you could unhide an “age” attribute and calculate the date of birth from said attribute only if there is value in there.

1 Like

Hi Davuya,

That is what value type “AGE” does. If you know the exact DOB, you can fill the date. If not, then it lets you put an estimated year, month, date

Thank you,

1 Like

Hi @Enzo and @Abyot_Gizaw,

In case of estimated age, are the three fields: years, months and days compulsory?

How can I calculate date of birth if the user enters either years, months or days on the person age field? I mean formula.

How to add a checkbox field Date of birth is estimated?


As Abyot stated, using the “Age” value type does work great for calculating the date of birth from the age (either months years or days, none are compulsory) and you don’t need a formula. You just need to change the value type of your “Date of birth” attribute from “date” to “age”

If I remember correctly there are some issues with using this in some versions of DHIS2 ( For example, when using a format different than YYYY-MM-DD, will update the post when I find the right Jira with the limitations)
Edit: here are the Jira tickets:
Log in - DHIS 2 JIRA (unresolved)
Log in - DHIS 2 JIRA (fixed for 2.34 onwards)

How to add a checkbox: You will need to create an attribute that is “yes only” and add it to your program attributes

How to calculate a date from years:

If you don’t use the Age value type and instead do this straight from an attribute where the age is stored in years, you will have to create a series of programme rules. Here is a good example (Using add d2:addDays)


Hi @Enzo,

Thank you for your help.

@dmbantu I’m glad you are finding this discussion useful (: If it’s solved, please mark as solved! :smiley:

Thank you!