cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ras1000
Level: Powered On

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
ras1000
Level: Powered On

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

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 Team
Community Support Team

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

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.
ras1000
Level: Powered On

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

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
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (4,678)