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 / Troubles with time con...
Power Automate
Unanswered

Troubles with time condition

(0) ShareShare
ReportReport
Posted on by 50

Hi!

I want to build a flow where every page of my site library is checked with the condition "Has it been modified in the last 2 hours?". If yes, I want to receive an email for every page.

I tried this:

(dynamic content) "Modified" is greater than (expression) formatDateTime(addHours(utcNow(),-2),'yyyyMMddThh:mm:ssZ')

But it does not work unfortunately, I only receive an email for 4 pages instead of +/- 40. I added the formatDateTime because "Modified" and utcNow() are not in the same format. You can find a screenshot of my flow bellow.

What do I do wrong?

Thank you in advance

Louis

louisquinet_0-1704967206774.png

 

Categories:
I have the same question (0)
  • abouchaalaBAIT Profile Picture
    932 Moderator on at

    Hello @louisquinet 

    Try this expression in order to get the time difference between two dates

    div(sub(ticks(outputs('yourStartDateTime')),ticks(outputs('yourEndDateTime')),600000000)

    ticks will convert dates into numbers. 

     

    Hope this helps

    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. 🆗✔️
    If you like my response, please give it a Thumbs Up. 👍
    You can accept more than one post as a solution.

  • louisquinet Profile Picture
    50 on at

    Hi @abouchaalaBAIT ,

    Thank you for your fast response!

    I do not completely understand where/how I need the use your expression.

    What do I replace by 'yourStartTimeDate' and 'yourEndTimeDate'.

    Where does the '600 000 000' in the expression stand for?

    Where do I have to place this expression on my flow.  

    Sorry I am a beginner at Power Automate...

    Thank you!

    Louis

  • abouchaalaBAIT Profile Picture
    932 Moderator on at

    No worries, I think you will better understand with those screenshots

    Here is the item that I created 29 minutes ago

    abouchaalaBAIT_1-1704970057374.png

    And here is my test flow

     

    abouchaalaBAIT_0-1704970030073.png

    I'm getting the item with ID 9 and trying to get the time difference 

    abouchaalaBAIT_2-1704970140053.png

    using this expression

    div(sub(ticks(outputs('Get_item')?['body/Modified']),ticks(utcNow())),600000000)

    • outputs('Get_item')?['body/Modified'] : yourStartDate
    • utcNow() : yourEndDate
    • ticks function : convert dates into number
    • sub : to get the difference
    • div : in order to get the minutes

     

    in your case, all what you have to do next is to add a condition and compare between the difference and 120 minutes

     

    Hope this helps

    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. 🆗✔️
    If you like my response, please give it a Thumbs Up. 👍
    You can accept more than one post as a solution.

  • louisquinet Profile Picture
    50 on at

    Hi @abouchaalaBAIT,

    I tried to do it with the expression: div(sub(ticks(outputs('Get_files_(properties_only)')?['body/Modified']),ticks(utcNow())),600000000) but I receive an error message when I run it.

    I changed 'Get_Items' by 'Get_files_(properties_only)' because I use this action in my flow. Is there a problem with this or is it something else?

    You can find a screenshot of my flow and the failed run of the flow bellow.

    Thank you for your help

    Louis

     

    The failed run:

    louisquinet_0-1704975154657.png

    The flow:

    louisquinet_1-1704975164000.png

     

     

     

     

  • abouchaalaBAIT Profile Picture
    932 Moderator on at

    use Get file properties instead of Get_files_(properties_only) 

    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. 🆗✔️
    If you like my response, please give it a Thumbs Up. 👍
    You can accept more than one post as a solution.

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 378 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 305 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 155 Most Valuable Professional

Last 30 days Overall leaderboard