Date of Birth to Age


Is there a way to input a date of birth and use a formula to calculate age? I found this post: How to get age from input date of birth. This is helpful, but we need to use the full date, not just the year.

ie: 09/06/1994 -> 28

Thanks in advance for your help!


Hey again Abby,

Sure, here's a way to do it:

Enter DoB: {formdate: YYYY-MM-DD; name=birthday}

Age in years: {=datetimediff(birthday, {time: YYYY-MM-DD}, "Y")}

If you don't like the date picker field, you could do it with a text box where you can write it in a certain format, then use datetimeparse to make it usable in the datetimediff function (would require you always write the date the same way):

Enter DoB: {formtext: name=birthday; default=06/21/1986}

Age in years: {=datetimediff(datetimeparse(birthday, "MM/DD/YYYY"), {time: YYYY-MM-DD}, "Y")}

These snippets use the datetimediff function which allows you to subtract two dates from each other. In this case, I'm subtracting the date in the field birthday from today's date {time: YYYY-MM-DD} and getting the result in years "Y"


Beautiful! Thank you :smile: