How to compute AGE from DOB

  1. I have a query that lists users from a table. One of the table columns is Date of Birth

  2. On the page I display the list, I want an additional column that will show a computed AGE of each user from the DoB in the table.

  3. Based on the computed Age, I want to add another column that shows a Qualified or Disqualified Status.

How do I achieve this?

Hi Francis,

If you do a quick google search you’ll find an sql statement that will add another column which is the age based on dob. Make sure to find one that deals with leap years. You can then use a custom query action to execute it, and it will just be part of your db result set. Similarly, you can add the other calculation.

—Ken

@enyonam, if you don’t want to do it via server side query, you can also do it via front-end on your page.
#2. you just add a table header (i.e. <th>) for the static column name, and then add a new row (i.e. <td>) for the calculation with your formula. You can use the Data Formatter for the difference in date. You can refer from this post: Time posted

#3. also add another table header and another <td> for the calculation.

2 Likes

Hi @enyonam
Here’s a quick tutorial explaining how to calculate age from date of birth:

1 Like

Thank you @Teodor and everyone. I will attempt @Teodor the solution and revert .