Skip to main content

Timeline for REST service $filter Date column

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
May 23, 2017 at 12:41 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Aug 27, 2015 at 0:13 comment added Alan M I spent a long time in vain until I found this answer; not knowing it is necessary to add 'datetime' in front of the datetime being tested, as in "endate gt datetime'1900-01-01T00:00:00'"
Oct 2, 2012 at 14:58 comment added Chris Jaynes I updated the post to show that I actually am using the ISO format. I like a library called Moment.js for dates. I tried using the SP date field as you describe, but it had all kinds of problems with inconsistencies in time zones. I guess what bugs me most about using the built-in Date format is that you receive the date in one format, and the queries use a different format. This is silly and error-prone. I'm going to stick with using my own date fields and Moment.js, which has no problems parsing it and formatting using the ISO standard on both sides.
Oct 2, 2012 at 5:21 comment added Anatoly Mironov I understand your frustration about this syntax. But how do you create this filterValue from a date? Do you have to convert it in javascript by using a custom format procedure? In the solution I showed you don't have to care about formatting, you work only with Date objects the whole way. Suppose: you have a datepicker: a user provides a date and you have to put it into the request. Here you no longer need to format it "manually", just create a standard ISO format by running date.toISOString(). In my opinion, it is less error prone.
Oct 1, 2012 at 13:46 comment added Chris Jaynes Hmm. Although I agree that you've boiled the syntax down to something that's a bit more manageable, it still seems strange to have to convert back and forth from dates to strings to dates. Since the data has to cross the http wire as a string, and I can't manipulate it server side, why wouldn't I just use a column that's a more friendly string format? If I just need to be able to compare these dates via really simple queries, why should I keep converting them back and forth? What does it buy me? Thanks for your answer! I'm curious to explore this idea a bit more...
Sep 29, 2012 at 18:29 history answered Anatoly Mironov CC BY-SA 3.0