web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Compare two dif...
Power Automate
Unanswered

How to Compare two different Times

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

When an item is created in a SPO List, I have a flow that kicks off.

It does a get of all items in the list, and then I compare the item created to the existing list.

If there is a duplicate, I convert the time from UTC to CST Short Date, send a teams message, and then send an email.

 

I would like to add to the check, if the assignment time of the item created, and the duplicate found, if the time difference is 10 minutes or less.

 

I would put this in the condition, but I dont know how to compare the two times, and check if the difference is 10 minutes or less.

 

lardo5150_0-1644406403583.png

 

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @lardo5150 

     

    You could use the formatDateTime expression for this.

     

    formatDateTime('YourDateTimeColumn', 'yyyyMMddhhmm')
     
    format both dates in above format and use the sub() expression to get the difference.
     
    Thanks
  • lardo5150 Profile Picture
    Microsoft Employee on at

    So I have tried it a few ways.

    I tried using variables, but the flow started erroring that I was entering a string when doing the dateformat.

    And then the sub would fail because it wanted an integer.

    So I combined them into the condition with this:

    sub(formatDateTime(triggerOutputs()?['body/AssignmentTime']),formatDateTime(items('Apply_to_each')?['AssignmentTime']))
     
    It still throws an error, as the Sub thinks it is a string and wants an integer.
    Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'sub' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#sub for usage details.'.
     
    So how do I do the formatdatetime so that it is an integer?
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @lardo5150 

     

    Try the below

     

    sub(int(formatDateTime(triggerOutputs()?['body/AssignmentTime'],'yyyyMMddHHmm')),int(formatDateTime(items('Apply_to_each')?['AssignmentTime'],'yyyyMMddHHmm')))

     

    Forgot to mentioned better to user the HH which is the 24 hour format.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard