cancel
Showing results for 
Search instead for 
Did you mean: 
ScottShearer

How to find the number of days between two dates using Power Automate

One question that is frequently asked on the Power Automate discussion boards is how to find the difference between two dates.  There is not currently a built-in Power Automate expression that will get the job done.  To find out ho to accomplish this requirement, read on...

 

In my scenario, I will want to find the difference in days between a date stored in a SharePoint list and the current date. 

Here's what we are going to do:

  1. Convert the two dates to ticks
    1. A tick is a small faction on a second
  2. Subtract one date from the other
    1. The result will be the difference in ticks
  3. Convert the ticks to days
    1. You're done!

Step 1 - Convert to ticks

Use the ticks() expression to convert both dates to ticks

image.pngimage.png

Step 2 - Get the difference in ticks

Use the sub() expression to find the difference between the two dates in ticks

image.png

 

Step 3 - Convert the difference in ticks to days

There are 864000000000 ticks in a day.  Divide the difference in ticks by 864000000000 to find the difference in days

image.png

 

I suspect that the Power Automate team will eventually give us an expression to find the difference between two dates.  Until then, use the technique outlined above.

Comments
Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Blog site: https://ganeshsanapblogs.wordpress.com/ MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/