OData中DateTimeOffset的格式 [英] Format of DateTimeOffset in OData
问题描述
我有两个JavaScript Date
对象.我需要在这两个Date
对象之间进行OData查询.我正在查询的信息有一个名为createDate
的字段,它是一个DateTimeOffset
.据我了解,我可以做这样的事情:
I have two JavaScript Date
objects. I need to do an OData query between these two Date
objects. The information I'm querying has a field called createDate
which is a DateTimeOffset
. From my understanding, I can do something like this:
entities?filter=((createDate ge [Date1]) and (createDate le [Date2]))
我的问题是:
- DateTimeOffset是什么格式?
- 如何将JavaScript Date对象转换为DateTimeOffset格式?
谢谢!
推荐答案
首先,它取决于您的OData服务版本. OData V4与OData V3不兼容.
First it depends your version of OData service. OData V4 is not compatible with OData V3.
OData V4
Format of DataTimeOffset please refer to CSDL spec of OData V4
过滤DateTimeOffset的示例是http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips?$filter=StartsAt eq 2014-01-01T00:00:00Z
An example of filtering the DateTimeOffset is http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips?$filter=StartsAt eq 2014-01-01T00:00:00Z
OData V3
DataTimeOffset的格式,请参考 OData V3的CSDL规范
Format of DataTimeOffset please refer to CSDL spec of OData V3
过滤DateTimeOffset的示例为http://services.odata.org/V3/OData/OData.svc/Products?$filter=ReleaseDate gt datetime'1995-09-01T00:00:00'
And example of filtering the DateTimeOffset is http://services.odata.org/V3/OData/OData.svc/Products?$filter=ReleaseDate gt datetime'1995-09-01T00:00:00'
这篇关于OData中DateTimeOffset的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!