ODATA DATE QUERY

前端 未结 2 463
梦如初夏
梦如初夏 2021-01-04 13:37

I need to return records that have a date of 4/4/2013 (for example). The date field in the ODATA service returns as {DATE: \"2013-04-04T17:39:33.663\"}

How is the qu

2条回答
  •  独厮守ぢ
    2021-01-04 14:21

    In addition I want to say that you can also use LINQPAD for generation OData requests. You should make LINQ request and LINQPAD will generate correct URI. For example:

    • Linq:

    from ev in Events where ev.Start >= DateTime.Now.Date select ev

    • LINQPAD generates Odata URI:

      http://yoursite/_vti_bin/listdata.svc/Events()?$filter=Start ge datetime'2013-12-05T00:00:00+01:00'
    • Adjust it to correct format. In my case I delete "+01:00".

    Also you can use Visual studio to get Odata request.

提交回复
热议问题