Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

Sending email when item is older than x hours


I have been building this flow in Logic Apps which checks the Created date of an item and sends an email if its older than x amount of days. This will be for 2 years. However during testing I need to test this with minutes or hours.


I've tried hours but it's not working for me - please review my flow below and let me know what I'm doing wrong.

addHours expression: addHours(utcNow(),-1,'yyyy-MM-dd')





Super User
Super User

Hello @sudosaurus ,

the formatDateTime(...) expression as you have it makes the addHours(...) irrelevant. If you format the date to 'yyyy-MM-dd', it'll remove the time information and keep only the date at 00:00:00. You should skip the custom format, use only:


The second point - if you use Created in the Filter Query, it'll always include date and time up to milliseconds. Therefore, you can't use the <eq> operator, I don't think you'll ever see an equal date and time to this level. You should use a range for the date:

Created gt 'bottom range' and Created le 'upper range'

For example, to get items created in the last hour:

Created gt 'addHours(utcNow(),-1)' and Created le 'utcNow()'

or items created 2 years ago where it makes sense to ignore the time and check items created between today - 2 years at 00:00:00 and today - 2 years + 1 day at 00:00:00.

Created gt 'addToTime(utcNow(), -2, 'Year', 'yyyy-MM-dd')' and Created le 'addDays(addToTime(utcNow(),-2, 'Year'),1)'


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,712)