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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (26,798)