cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Flow Query Filter Date Range

Basically I am doing a Get Items and attempting to filter the data based on a date range. I have come across MANY different suggestions and have attempted them all with no luck.

 

Here is what I am working with:

From Date: Date Only

To Date: Date Only

 

The Get Items works properly with no query and returns everything, but I want to filter based on passed in dates.

 

Here is how it currently looks:

10-29-2020 10-25-03 AM.jpg

 

I have tried many different options for converting the date values such as datetime'fromDate' with no luck.

All I receive is the filter is not valid.

 

Thanks for any help. 😃

1 ACCEPTED SOLUTION

Accepted Solutions
Advocate I
Advocate I

After about a week of messing with it I make a post and figure it out 15 minutes later lol

 

Here is what it ended up being:

From Date: 

formatDateTime(triggerBody()?['From'],'yyyy-MM-dd')

To Date: 

formatDateTime(triggerBody()?['To'],'yyyy-MM-dd')

10-29-2020 10-29-15 AM.jpg

View solution in original post

10 REPLIES 10
Advocate I
Advocate I

After about a week of messing with it I make a post and figure it out 15 minutes later lol

 

Here is what it ended up being:

From Date: 

formatDateTime(triggerBody()?['From'],'yyyy-MM-dd')

To Date: 

formatDateTime(triggerBody()?['To'],'yyyy-MM-dd')

10-29-2020 10-29-15 AM.jpg

View solution in original post

How did you write in the dates?

 

Like this?

 

formatDateTime(triggerBody()?['From'],'2019-01-01')

@WC-KSTILL

Kind of, the portion where you have the '2019-01-01' needs to be how I typed it as 'yyyy-MM-dd' as formatDateTime takes 2 arguments, the first is a date/time value, for my case I had a column named From, so triggerBody()?['From'] is my date.

The second is what format you want to date to be returned as. Here is the documentation on it, you can use any or all of these letters    formatDateTime('<your-value>', 'dd/MM/yyyy hh:mm tt')   which denote the different type of date/time information you want returned.

I still can't figure this out...

 

 

I am trying to get all items created on or after 01-01-2018 

 

I tried a combination of things.

 

I had this working but it suddenly stopped, no idea why. It returns 0 results now

 

Created ge '@{getPastTime(1033,'Day')}'

 

How can I use your formatDateTime saying Created Date anything older that 01-01-2018

I meant, anything equal to or newer than 01-01-2018

I also tried

 

formatDateTime('2018-01-01T00:00:00''M/dd/yyyy h:mm tt')

@WC-KSTILL

If you have a static date you can just do Created ge '2018-01-01' you are only passing in a string in the format of 'yyyy-MM-dd' (yyyy=year, MM=month, dd=day)

You can use a variable or compose a data value, or basically anything to get the info in there. ensure you have the ' on both ends of what you are passing in though.

I tried your suggestion, still 0 results. I am going to re-create this from scratch.. I feel like its bugged or something

@WC-KSTILL Are you inserting an expression or just manually typing this into the area?

I figured it out...I ahd to go to settings and turn on the threshold. Never had to do that before

 

Created gt '2019-01-01T00:00:00Z'

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (12,214)