Hello,
I am trying to show age by year on a tab based on a date from registration.
I have a field in registration called "cb_dob", which is a date picker. I have a second field called "cb_age" that display's on a custom tab "Registry"
I simply want to show the calculated age in years on the "Registry" based on "cb_dob" from the registration.
(The Registry Tab is a collection of personal questions that are not in the registration process. Also Registry is an optional element, which the users opts to be in after the registration process. I need the DOB on the registration, and would rather not place a second DATE picker on Registry.)
I set up a query field called cb_age that displays on Registry. I added this query:
Code:
SELECT `cb_dob` , CURDATE( ) , TIMESTAMPDIFF( YEAR, `cb_dob` , CURDATE( ) ) AS cb_age
FROM `#_comprofiler` WHERE `user_id` = '[user_id]'
When I do a test in MySQL I get the correct age as a number (i.e. 55), but when I place it in Community Builder, it display's the user's birthday as a DATE (i.e. 1961-09-20), but not the age in years.
What am I doing wrong? or Is there a better way of accomplishing this?
Thanks,
HighOnRyan