cancel
Showing results forย
Did you mean:ย
Helper I

## Calculating age from birth date and current date using Workflow Definition Language expressions

If I have a date of birth (from a Microsoft form question) and have inserted it into an Excel table row, how would I calculate age using a Workflow Definition Expression which would be placed in an Excel table column beside the one for date of birth?

1 ACCEPTED SOLUTION

Accepted Solutions
Helper I

I did manage to get age using ticks for the birthdate (from Microsoft Form field) and utcNow.  After dividing by a couple of constants I was able to get age as a float.

Expression is:  div(div(sub(variables('Today'),variables('Birthdate')),864000000000),365.25)

Variable Today is "ticks(utcNow())"

Variable Birthdate is "
ticks(body('Get_response_details')?['rde329303c5a04b32b9b9f35a0564400e']) based on Microsoft Form response field.

At the end of the day I did not go ahead with the calculation as the result is not dynamic, i.e. result does not change if someone has a birthday.

2 REPLIES 2
Community Support

Hi @ras1000,

Currently it is not possible to use a datediff function in flow to count days between two days. There is a similar request on Flow Ideas Forum, please vote the idea at here:

https://powerusers.microsoft.com/t5/Flow-Ideas/workflow-definition-language-needs-to-be-expanded/idi...

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Helper I

I did manage to get age using ticks for the birthdate (from Microsoft Form field) and utcNow.  After dividing by a couple of constants I was able to get age as a float.

Expression is:  div(div(sub(variables('Today'),variables('Birthdate')),864000000000),365.25)

Variable Today is "ticks(utcNow())"

Variable Birthdate is "
ticks(body('Get_response_details')?['rde329303c5a04b32b9b9f35a0564400e']) based on Microsoft Form response field.

At the end of the day I did not go ahead with the calculation as the result is not dynamic, i.e. result does not change if someone has a birthday.

Announcements

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Check out how to claim yours today!

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (50,903)