在x&之间过滤日期y使用ODATA [英] Filtering dates between x & y using ODATA

查看:58
本文介绍了在x&之间过滤日期y使用ODATA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究新的ASP.NET Web API作为报告工具.

I'm looking into the new ASP.NET Web API as a reporting tool.

在SQL中,我会这样做:

In SQL I would do this:

WHERE order_date 
    BETWEEN to_date ('2003/01/01', 'yyyy/mm/dd') 
    AND to_date ('2003/12/31', 'yyyy/mm/dd');

...这些类型的命令如何在ODATA协议URL中转换?

...how do these type of command translate in the ODATA protocol URL?

推荐答案

使用 Visual Studio 2012.2 更新,OData支持又回来了,以下网址可用于过滤日期:

With the Visual Studio 2012.2 update, OData support is back and the following url works for filtering dates:

http://host/api/controller?$filter=order_date+gt+datetime'2003-01-01'+and+order_date+lt+datetime'2003-12-31'

如果要包含时间,则应以 ISO 8601 格式指定日期.

If you want to include a time, you should specify the dates in ISO 8601 format.

这篇关于在x&之间过滤日期y使用ODATA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆