cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Continued Contributor
Continued Contributor

odata filter query - equals today's date

Screenshot 2020-11-18 120024.pngI'm using SharePoint Get Items and applying a filter query there. I want to only retrieve items where the date in the list (Outward_x0020_date) is equal to today's date. 

I've tested it several times with different queries but Outward_x0020_date eq formatDateTime(utcNow(), 'dd/MM/yyyy') is the one I think should work. However I get the error The expression "Outward_x0020_date eq 18/11/2020" is not valid. Creating query failed. I've also tried putting single ' ' around the date but that also had an error.

 

It must be something to do with the date format, but this is the format used in the SP list. Any ideas?

 

 
 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
calvares
Continued Contributor
Continued Contributor

Thanks for the suggestions @Expiscornovus . This didn't work as my column doesn't include time.  However, I've worked out that even though the format of the date in my SP list is dd/MM/yyyy, the date appears as 'yyyy-MM-dd'.

So once I set my query to: 

formatDateTime(utcNow(), 'yyyy-MM-dd') it worked.

 

View solution in original post

3 REPLIES 3
Expiscornovus
Super User II
Super User II

Hi @calvares,

 

My guess would be that it is expecting time as well. Can you try and use this expression to see if will make your expression valid?

 

 

 

Outward_x0020_date eq '@{ formatDateTime(utcNow(),'dd/MM/yyyyT00:00:00Z')}'

 

 

 

 

Btw, can you also check the column settings of your Outward date column? If it is using time I would recommend changing that, if possible. Because if you strip away the time the Filter query can become a bit easier:

 

 

Outward_x0020_date eq '@{ formatDateTime(utcNow(),'dd/MM/yyyy')}'

 

 

 

includetime.png

calvares
Continued Contributor
Continued Contributor

Thanks for the suggestions @Expiscornovus . This didn't work as my column doesn't include time.  However, I've worked out that even though the format of the date in my SP list is dd/MM/yyyy, the date appears as 'yyyy-MM-dd'.

So once I set my query to: 

formatDateTime(utcNow(), 'yyyy-MM-dd') it worked.

 

View solution in original post

Expiscornovus
Super User II
Super User II

@calvares, great to hear that you found your solution. And happy to help 🙂

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,074)