-1

I would like to sort date to include 6am to 10 am and also 3pm to 7 pm. There is no- date is "between" sort option. I do not know SQL, or anything

Marty
  • 1

1 Answers1

1

There's definitely a BETWEEN option for dates, and you can learn more here: https://dev.socrata.com/docs/functions/between.html

Here's an example based off the NYC 311 dataset API:

https://data.cityofnewyork.us/resource/fhrw-4uyv.json?$where=created_date BETWEEN '2015-07-04T06:00:00' AND '2015-07-04T10:00:00' OR created_date BETWEEN '2015-07-04T15:00:00' AND '2015-07-04T19:00:00'

That'll get you all 311 requests between 6AM and 10AM or 3PM to 7PM on July 4th.

Don't get scared by the fact that SoQL looks like SQL, it's actually much simpler.

chrismetcalf
  • 1,556
  • 1
  • 8
  • 7
  • Thank you. Don't know SoQL either. Can I copy and paste that line, changing date? – Marty Dec 02 '15 at 19:40
  • @chrismetcalf in my example I only receive 1000 entries, whats the reason: https://data.cityofnewyork.us/resource/h9gi-nx95.json?$where=date BETWEEN '2015-07-04' AND '2015-07-04' – ZerOne Nov 12 '19 at 17:53
  • 1
    @ZerOne The API provides 1000 records per page as the default. You can change that with the right parameters: https://dev.socrata.com/docs/paging.html – chrismetcalf Nov 13 '19 at 19:46