cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
koneill2020
Helper II
Helper II

Using Filter Query Between Two Dates

All, 

 

I am trying to run a Get Items action using a Filter query to obtain results between my StartDate and EndDate for 7 days out as such:

StartDate ge (utcnow()+7),'dd-MM-yyyy') and Enddate lt (utcnow()),'dd-MM-yyyy'))

koneill2020_1-1650483166361.png

 

this is giving me the following error:

{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"StartDate ge (utcnow()+7),'dd-MM-yyyy') and Enddate lt (utcnow()),'dd-MM-yyyy'))\" is not valid."}}}

 

so not being a Filter Query guru - what is the correct syntax for obtaining what I am trying to do.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @koneill2020  ,

 

Please try:

StartDate gt '@{addDays(utcNow(),7,'yyyy-MM-ddTHH:mm:ssZ')}' and Enddate lt '@{utcNow('yyyy-MM-ddTHH:mm:ssZ')}' 

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
GeorgiosG
Super User
Super User

Hi @koneill2020 ,

 

try using addDays(utcNow(),7) instead of your brackets.

 

https://powerusers.microsoft.com/t5/Building-Flows/Sharepoint-Get-Items-ODATA-Filter-with-adddays/td...

 

Happy to help.
If I have answered your question, please mark your post as Solved.
v-bofeng-msft
Community Support
Community Support

Hi @koneill2020  ,

 

Please try:

StartDate gt '@{addDays(utcNow(),7,'yyyy-MM-ddTHH:mm:ssZ')}' and Enddate lt '@{utcNow('yyyy-MM-ddTHH:mm:ssZ')}' 

 

Best Regards,

Bof

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,776)