Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  174] [ 6]  / answers: 1 / hits: 16040  / 10 Years ago, tue, january 20, 2015, 12:00:00

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!


More From » odata

 Answers
13

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'


[#68155] Friday, January 16, 2015, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaelynncherokeeg

Total Points: 697
Total Questions: 109
Total Answers: 104

Location: France
Member since Thu, Mar 18, 2021
3 Years ago
jaelynncherokeeg questions
Thu, May 27, 21, 00:00, 3 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
Wed, Sep 18, 19, 00:00, 5 Years ago
;