How to Compare Date Using Ticks Function in Power Automate?

I ran into an unexpected issue while working on a Power Automate flow. I needed to compare two dates: today’s date and a date five days in the future. I used the formatDateTime() function to format the dates, but when I applied the condition to check if today’s date was greater than today + 5 days, the flow incorrectly returned “Yes.”

After some research, I discovered the issue was due to string-based comparisons rather than actual date values. The solution? The ticks() function! It converts dates into numerical values, making comparisons accurate.

In this tutorial, I will tell you what is Power Automate ticks function and how to compare date using ticks() function in Power Automate.

ticks Function in Powet Automate

The ticks() function converts a date into a numeric value representing. This number counts tiny time units (100-nanosecond intervals) from the year 0001. Since it’s just a number, comparing dates becomes easy and accurate.

Syntax:

ticks(timestamp)
  • timestamp: The date and time value you want to convert into ticks.
What is the ticks Function in Powet Automate

Example:

If today is Feb 24, 2025, then:

ticks(utcNow())
Calculate the Number of Days between Two Dates with Power Automate

The last few numbers may vary because of the time.

Check out How to Auto Generate Serial Number in Power Automate?

Compare Date using the ticks() Function in Power Automate

Now, I will show how to compare. For this, I am checking if today’s date exceeds today + 5 days. Let’s see how to do it.

1. Create an Instant Cloud Flow by selecting the ‘Manually trigger a flow’ trigger action.

Compare dates using conditions in Power Automate

2. Add a compose action and provide the below expression, which converts today’s date to ticks:

ticks(utcNow())
How to compare dates in Power Automate using ticks

3. Again, add the compose action and provide the below expression:

ticks(addDays(utcNow(),5))
  • utcNow() – Returns the current date and time in UTC.
  • addDays(utcNow(),5) – Adds 5 days to the current date.
  • ticks(…) – Converts the resulting date-time value into a tick count.
What 'ticks(outputs)' is used for in Power Automate flows

4. Add a Condition action to compare which is the greater:

  • Left Side: Select the Today Ticks (from Dynamic Content).
  • Operator: is greater than
  • Right Side: Select the Future Ticks (from Dynamic Content).
power automate - compare date to today

5. Inside the true section, add the compose action and provide the below expression:

formatDateTime(utcNow(),'dd/MM/yyyy')
power automate compare date without time

6. Inside the false section, add another compose action and provide the below expression :

formatDateTime(addDays(utcNow(),5),'dd/MM/yyyy')
How to Compare Date in Ticks Function in Power Automate

Save your flow and manually trigger it using the Run button. Then you can see the false part run because 01/03/2025 (Today + 5 days) is greater than 24/02/2025 (Today Date).

How to Compare Date using Ticks Function in Power Automate

Conclusion

In this tutorial, I explained the issue with comparing dates in Power Automate due to string-based comparisons and learned the ticks() function as the solution. I covered the Power Automate Ticks function, how it converts dates into numeric values, and how to use it for accurate date comparisons.

Related Power Automate tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…