Skip to Content

How to Filter Out Records with Null DateTime Values in a GET Request for OData Service


I am making a GET request on an OData service to get entities which have, among other fields, a DateTime (YYYY-MM-DDTHH:MM:SS) type of field. This field is filterable. I want to filter out those entities for which this DateTime field is null.

How should the URI be framed so that this can be achieved?

I have already tried the following but to no avail:

1. Checking for equality with 0000-00-00T00:00:00 - It does not help as the system apparently considers a null value different from an initial value (such as above).

2. Adding the dual condition "DateTime > 0000-00-00T00:00:00" and "DateTime < 9999-12-31T00:00:00"


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 16, 2017 at 01:21 PM

    While I was doing a hit-and-trial, I found that I was able to filter out the blank values by using the condition gt datetime'0001-00-00T00:00:00'.

    Add comment
    10|10000 characters needed characters exceeded