Get Today’s date in Power Automate/ Microsoft Flow

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com

Hi All, I am back with one more tip from Power Automate. In this blog I am going to show you on how to get current date in your Power Automate flows.
And with a real life example here. So here is the requirement.


Whenever a record in Dynamics 365 is updated, we need to compare the record’s created on date with the current date. If both have been created on the same date, the flow takes one course else it follows some other path. But how we can do it?
You might be wondering, isn’t there a function utcnow(). Well there is. But the point is there it returns date and time. We don’t need the time part. We just need to compare if they are created on the same date.


So let’s see how we can accomplish this requirement here.


We have this simple flow here.  The flow is fired when the when a record is updated in Dynamics 365/ CDS. In the next step we perform a comparison of the current date and created on field for the updated record. And check if they are the same date.
image
As you can see, to get the current date we are using the utcnow() function inside the formateDateTime function with the format ‘yyyy-MM-dd’. Even the created on field we use the formatDateTime function to get the date value.
Formula

formatDateTime(utcNow(), 'yyyy-MM-dd')

image
Formula:

formatDateTime(triggerBody()?['createdon'], 'yyyy-MM-dd')

So all we need was to use the formatDateTime function with utcnow() to get Today’s date in Power Automate.


Hope this helps!

Debajit Dutta
(Microsoft MVP)


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading