Jump to content

Calculate Age Based on Birth Date Text Field

Recommended Posts

Looked around many Caspio forum posts and just wanted to post the latest for calculating Age from a Birth Date Text Field.

Set up a text field in your table called: Birth_Date. 

In the datapage text field for Birth_Date select Calendar Pop-Up. 

In your details page add underneath the Birth_Date field, a calculated field with the code: FLOOR(DATEDIFF(DAY, [@field:Date_of_Birth1], SysDateTime()) / 365.25).

This updates other Caspio previous posts that didn't properly calculate the age. 

Link to comment
Share on other sites

  • 2 weeks later...

I usually use this formula to calculate the exact age and it works correctly too.

DATEDIFF(year, [@field:Date_of_Birth], SysDateTime())
  WHEN DATEADD(year, DATEDIFF(year, [@field:Date_of_Birth], SysDateTime()), [@field:Date_of_Birth]) > SysDateTime() 
  THEN 1
  ELSE 0

This formula is also provided in this article https://howto.caspio.com/datapages/reports/advanced-reporting/calculated-fields-and-datediff-function/

Since age calculating requires using functions to get the today`s day and these functions are not supported in the Formula field in the Table, the workaround to store the age in the Table (if needed) is to use a Task:


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...