How to get Web API OData v4 to use DateTime

前端 未结 12 1207
时光取名叫无心
时光取名叫无心 2020-12-02 14:50

I have a fairly large data model that I want to expose using Web API OData using the OData V4 protocol.

The underlying data is stored in a SQL Server 2012 database.

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 15:28

    Both the following work with ODATA 4

    1 : This is the Latest update I see with .Net 4.7 and Microsoft.Aspnet.ODATA 5.3.1

    $filter=DateofTravel lt cast(2018-05-15T00:00:00.00Z,Edm.DateTimeOffset)
    

    2 : This also works , it needs to be in this yyyy-mm-ddThh:mm:ss.ssZ

    $filter=DateofTravel lt 2018-02-02T00:00:00.00Z
    

提交回复
热议问题