Search code examples
c#datetimeuriodata

OData DateTime filter Edm.String error?


I am writing an DateTime filter query in OData like this:

... + "$filter=SubmitTime lt datetime'2014-12-30T23:59:59.99Z'"

and met the following error:

enter image description here

I did follow the OData format guideline and other online references, and the string I wrote is aligned with the guideline.

So is this a problem caused by dll version? like stated in this post: WebAPI OData DateTime error

The Microsoft.OData.Edm.dll version I am using is: Runtime Version: v4.0.30319 Version: 6.3.0.0

Any ideas? Thanks!


Solution

  • It seems that you are using the OData library which implement OData V4. In OData V4 spec, no DateTime primitive type exist, only have DateTimeOffset.

    Could you try the URL:

    ...?$filter=SubmitTime lt 2014-12-30T23:59:59.99Z