dynamics-crmdatediffdynamics-365power-automatecommon-data-service

DateDiff() Function in PowerAutomate: Where is it?


I've been doing a lot of Power BI work lately and has been a bit since I've had to construct any Flows. In fact, it was still MS Flow before renamed to PowerAutomate.

Anyways, I could have sworn there was a DateDiff() function which is not there now. So I need a bit of help.

I built a scheduled flow to run every morning on all 'Account' records that calculates the number of days until "Renewal Date". As seen below:

enter image description here

The "Days until Renewal Date" field is an int field and "Renewal Date" is a date field. When attempting to use the following expression for "Days Until Renewal Date," it is not saving to the field in the flow and am assuming that bc this function is no longer valid:

enter image description here

Any advice on this would be helpful.


Solution

  • There is no simple function to calculate the difference between two dates in Power Automate. What you can do instead is

    The result will be the difference in days between the two dates.

    Edit after a useful comment by user "once":

    Substitute the big number with 36000000000 and you will get hour difference, 600000000 minute difference, 10000000 difference in seconds