OData中DateTimeOffset的格式 [英] Format of DateTimeOffset in OData

查看:209
本文介绍了OData中DateTimeOffset的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个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]))

我的问题是:

  1. DateTimeOffset是什么格式?
  2. 如何将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

DataTimeOffset的格式,请参考

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屋!

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