cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (81,849)