title: How to select a date range from a JSON string by using jq?
body: <p>I have a JSON string like this (MacOS):</p>
  
  <pre><code>[{
      "id": 3624,
      "created_at": "2016-10-21T20:51:16.000+08:00",
    },
    {
       "id": 3625,
      "created_at": "2016-10-22T08:09:16.000+08:00",
    },
   {
       "id": 3626,
      "created_at": "2016-10-23T09:19:55.000+08:00",
    }]
  </code></pre>
  
  <p>I wanna select "created_at" from "2016-10-21" to "2016-10-22";
  I wanna get result like this:</p>
  
  <pre><code>[{
      "id": 3624,
      "created_at": "2016-10-21T20:51:16.000+08:00",
    },
    {
       "id": 3625,
      "created_at": "2016-10-22T08:09:16.000+08:00",
    }]
  </code></pre>
  
  <p>Can someone point me in the right direction?</p>
  
  <p><strong>The problem is solved.</strong>
  Now,i use this code to select date right to the minute,i hope it's useful for others:</p>
  
  <pre><code>jq --arg s '2016-10-26T18:16' --arg e '2016-10-27T20:24' '[($s, $e) | strptime("%Y-%m-%dT%H:%M") | mktime] as $r
    | map(select(
          (.updated_at[:19] | strptime("%Y-%m-%dT%H:%M:%S") | mktime) as $d
            | $d &gt;= $r[0] and $d &lt;= $r[1]))' &lt;&lt;&lt; "$requestJson"
  </code></pre>