最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Format of DateTimeOffset in OData - Stack Overflow

programmeradmin1浏览0评论

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]))

My question is:

  1. What format is a DateTimeOffset?
  2. How do I convert a JavaScript Date object to DateTimeOffset format?

Thank you!

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]))

My question is:

  1. What format is a DateTimeOffset?
  2. How do I convert a JavaScript Date object to DateTimeOffset format?

Thank you!

Share Improve this question asked Jan 20, 2015 at 14:35 xam developerxam developer 1,9836 gold badges29 silver badges39 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 15

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

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

Format of DataTimeOffset please refer to CSDL spec of OData V3

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'

发布评论

评论列表(0)

  1. 暂无评论