cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ras1000
Helper I
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

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.

 

View solution in original post

2 REPLIES 2
v-yamao-msft
Community Support
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.

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.

 

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (50,903)