使用之间的Odata url转换日期

时间:2014-04-22 05:05:31

标签: c# java android odata odata4j

我有这样的查询

 select * 
from xxx 
where dates between '2012-10-26' and '2012-10-27'

如何将此转换为Odata服务中的网址

2 个答案:

答案 0 :(得分:0)

我解决了这个像这个

转换为URL的查询
$format=json&$filter=year(LastModifiedDate)+ge+2012+and+month(LastModifiedDate)+ge+09+and+day(LastModifiedDate)+ge+25+and+hour(LastModifiedDate)+ge+00+and+minute(LastModifiedDate)+ge+00+and+second(LastModifiedDate)+ge+00+and+year(LastModifiedDate)+le+2012+and+month(LastModifiedDate)+le+12+and+day(LastModifiedDate)+le+31+and+hour(LastModifiedDate)+le+23+and+minute(LastModifiedDate)+le+59+and+second(LastModifiedDate)+le+59

答案 1 :(得分:0)

可以像这样查询:         http://service/odata/Products?$filter=dates gt datetime'2012-10-26' and dates lt datetime'2012-10-27