Power Automate Introduction

Power Automate has recently introduced an innovative function aimed at calculating the difference between two dates. However, finding the difference between two dates in Power Automate was quite complex, and with the recent introduction of dateDifference() function, Microsoft has eased that out.

In this blog, we will see how the process of calculating the difference between two dates has been simplified compared to the complex logic of using ticks() function.

Traditionally, this task could be achieved using the ticks() function, which seemed complex compared to the dateDifference() function. By leveraging the dateDifference() function, individuals can effortlessly compute the exact number of days left until a license subscription reaches its termination date. I have created a power automate flow for the creation of Account entity records. Also, I have fields for Start Date and End Date of a License, and also a whole number field for Expiry days field to display the remaining days until the license expires.

Login into Make.powerapps.com

Power Automate

Click on the Instant then search for “When a row is added, modified or deleted”

Add an action “Update a row” to show the remaining expire days.

Next Click on “show advanced options”

split(dateDifference(formatDateTime(utcNow(),’yyyy-MM-dd’), formatDateTime(triggerOutputs()?[‘body/anish_enddate’],’yyyy-MM-dd’)),’.’)[0]

Here we get the only days remaining for the expiration of the license by extracting the hours, mins, secs.

Here the output for the 8 days

Conclusion
In this blog, we explored the dateDifference() function and saw how it simplifies the complex logic for calculating the difference between the two dates.

For any Help or Queries Contact us on info@crmonce.com or +919014146800

We have started a new online retail store  Please Visit.