OData v2 – How to filter for Date fields?

Note: I know about this and other question that are similar to this question. But they don’t work.

I want to send a filter query to Olingo OData v2 service running on Spring Boot. The filter happens on a Date field. After several Googling, and reading the documentation, the closest solution I could arrive to was:

http://{url}/odata/ResourceTable?$filter=DateField gt datetime'2012-05-29T09:13:28' 

But, this is still showing errors:

{
    "error": {
        "code": null,
        "message": {
            "lang": "en",
            "value": "java.util.GregorianCalendar cannot be cast to java.util.Date"
        }
    }
}

Is there something wrong with how I wrote the OData URL query or is there some problem with how I defined the Entities on Spring Boot?

Leave a Reply

avatar
  Subscribe  
Notify of